Friday, January 18, 2013

[SharePoint] Scopes


When developing SharePoint solutions, we need to worry about "scopes".

Scopes define where the "things" we are developing will be reflected within the SharePoint farm.

There are two scopes to be aware of:

  • Solution Deployment Scope (assemblies location)
    • GlobalAssemblyCache
    • WebApplication
    • Sandbox
 This tells the compiler where you want to deploy the WSP solution to. It can either be added to the whole Farm (c:\windows\assemblies), to a specific Web Application (\bin folder) or to the Solution Gallery, through a Sandboxed solution. The chosen scope can be any of them in order to a regular feature for a website to work, but permissions become more limited as the scope is narrowed.

 

  • Feature Scope
    • Farm
    • Web Application
    • Site
    • Web
Feature Scope is used when we have a custom feature that we want to have enabled for activation on a specific location. The Scope can be the Farm if we're creating something generic as a feature stapler. It can be a web application if it's something that affects a whole Web Application at once. Finally, it can be made available in the site features of the Site (Site Collection root web site), or Web (any or all existing websites).





From MSDN
"Scope
Required Text. Specifies the scope in which the Feature can be activated and contains one of the following values: Farm (farm), WebApplication (Web application), Site (site collection), Web (Web site). For information about scope, see Element Scope."

No comments:

Post a Comment