SPC016002: Declare Scope for Receivers in Site Features |
SPC016002: Declare Scope for Receivers in Site Features |
If event receivers are used within a feature with scope 'Site' the attribute 'Scope' should be specified.
TypeName: | DeclareScopeForReceiversInSiteFeatures |
CheckId: | SPC016002 |
Severity: | CriticalWarning |
Type: | ReceiverDefinitionCollection |
The Receiver element should specify attribute 'Scope' with value 'Site' or 'Web'. See MSDN: 'When a SharePoint Feature is scoped to the site collection level, a 'Receivers' tag is potentially ambiguous. The tag can indicate either site-wide event binding or event binding for the top-level site. Note, however, that the default behavior is to scope to the site level. Therefore, when you scope a Feature to the site collection level, use the attribute named Scope to specify the intended scope. When you set this attribute to 'Site', event receivers that are defined inside a Feature that is scoped to the site collection are then bound at the site collection level. When the attribute is set to 'Web', event receivers that are defined for a Feature of a site collection are bound at the root Web site of that site collection.'. See sample below:
Copyright © 2013 RENCORE AB. All Rights Reserved
Disclaimer: The views and opinions expressed in this documentation and in SPCAF are those of the creators and do not necessarily reflect the opinions and recommendations of Microsoft or any member of Microsoft. All trademarks, service marks, collective marks, copyrights, registered names, and marks used or cited by this documentation are the property of their respective owners. SharePoint Code Analysis Framework, Version 4.5.2.7855, see www.spcaf.com for more information |