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:

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
          <Assembly>SimpleUpdateEventHandler, Version=, Culture=neutral, PublicKeyToken=10b23036c9b36d6d</Assembly>

comments powered by Disqus