70-573 · Question #261
You create a Feature named Feature1. Feature1 is activated in a SharePoint site. You create a Web Part that contains the following code. SPWeb web = site.OpenWeb(); SPFeatureDefinition feature =…
The correct answer is C. web.Features.Add(feature.Id). beingthe root site (or root web) of this collection. The statement "activate Feature1 in Site1 only" makes it unclear how to treat "Site1" -- as a site collection or asa root web. However, the second sentence of this question states: "Feature 1 is activated in SharePoint site"…
Question
You create a Feature named Feature1. Feature1 is activated in a SharePoint site. You create a Web Part that contains the following code. 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?
Options
- Asite.Features.Add(feature.Id);
- Bsite.WebApplication.WebService.Features.Add(feature.Id);
- Cweb.Features.Add(feature.Id);
- Dweb.Site.WebApplication.WebService.Features.Add(feature.Id);
How the community answered
(50 responses)- A2% (1)
- B10% (5)
- C82% (41)
- D6% (3)
Explanation
beingthe root site (or root web) of this collection. The statement "activate Feature1 in Site1 only" makes it unclear how to treat "Site1" -- as a site collection or asa root web. However, the second sentence of this question states: "Feature 1 is activated in SharePoint site". Well,SPWeb class represents SharePoint website. That's why I picked Answer C, and you are free to disagree with me. It is possible that Answer A is the correct one for this question.
Topics
Community Discussion
No community discussion yet for this question.