nerdexam
Microsoft

70-573 · Question #56

You create a Feature named Feature1. Feature1 is activated in a SharePoint site. You create a Web Part that contains the following code. - Dim web As SPWeb = site.OpenWeb() - Dim feature As…

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"…

Developing SharePoint Solutions

Question

You create a Feature named Feature1. Feature1 is activated in a SharePoint site. You create a Web Part that contains the following code.

  • 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?

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

(21 responses)
  • A
    10% (2)
  • B
    5% (1)
  • C
    81% (17)
  • D
    5% (1)

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

#Feature activation#SPFeature#SPWeb scope#site collection

Community Discussion

No community discussion yet for this question.

Full 70-573 Practice