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. SPSite site = new SPSite(“http://intranet/site1”);
SPWeb web = site.OpenWeb(); SPFeatureDefinition feature =
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. SPSite site = new SPSite(“http://intranet/site1”);
SPWeb web = site.OpenWeb(); SPFeatureDefinition feature =
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.
site.WebApplication.WebService.Features.Add(feature.Id);

B.
web.Features.Add(feature.Id);

C.
site.Features.Add(feature.Id);

D.
web.Site.WebApplication.WebService.Features.Add(feature.Id);



Leave a Reply 0

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