Which code segment should you add to the Web Part?

You create a Feature named Feature1. Feature1 is activated in a SharePoint site. You create a
Web Part that contains the following code. Dim site As New SPSite(“http://intranet/site1”) Dim web
As SPWeb = site.OpenWeb() Dim feature As SPFeatureDefinition =
SPFarm.Local.FeatureDefinitions(“Feature1”) You need to modify the Web Part to activate
Feature1 in Site1 only. Which code segment should you add to the Web Part?

You create a Feature named Feature1. Feature1 is activated in a SharePoint site. You create a
Web Part that contains the following code. Dim site As New SPSite(“http://intranet/site1”) Dim web
As SPWeb = site.OpenWeb() Dim feature As SPFeatureDefinition =
SPFarm.Local.FeatureDefinitions(“Feature1”) You need to modify the Web Part to activate
Feature1 in Site1 only. Which code segment should you add to the Web Part?

A.
web.Site.WebApplication.WebService.Features.Add(feature.Id)

B.
site.Features.Add(feature.Id)

C.
site.WebApplication.WebService.Features.Add(feature.Id)

D.
web.Features.Add(feature.Id)



Leave a Reply 0

Your email address will not be published. Required fields are marked *