This topic has not yet been rated - Rate this topic

SPRoleAssignmentCollection.AddToCurrentScopeOnly Method

SharePoint 2010

Adds a role assignment to the collection of role assignment objects at the current scope.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online
public void AddToCurrentScopeOnly(
	SPRoleAssignment roleAssignment
)

Parameters

roleAssignment
Type: Microsoft.SharePoint.SPRoleAssignment
The role assignment to add.

This method does not propagate the security principal in the Member property of the SPRoleAssignment object to the SPRoleType.Guest role of the parent scopes. If you do want to ensure that the security principal has at least limited access to objects in parent scopes, then you should call the Add(SPPrincipal) method.

Note Note

When you call the SPRoleAssignmentCollection.Remove method, the remove operation affects the current scope and all sub scopes regardless of whether the SPRoleAssignmentCollection.AddToCurrentScopeOnly method is used to create any of the scopes.

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
How to add group with Limited Access permission?
Document related to FGP (http://www.microsoft.com/download/en/details.aspx?id=9030) says: When users are added to individual scopes under the Web level, using the new SharePoint 2010 Products SPRoleAssignmentCollection.AddToCurrentScopeOnly method, they can also then be added, by additional code, to the new group that has already been established as having Limited Access rights at the Web and document library level.

How to add group with Limited Access rights? Create your own permission level (My Limited Access). Detailed description can be found here: http://www.martinhatch.com/2011/10/scaling-to-10000-unique-permissions_04.html
SPRoleAssignmentCollection.Remove operation and how it affects scope
Note that when you call the SPRoleAssignmentCollection.Remove method, the remove operation affects the current
scope and all sub scopes regardless of whether the SPRoleAssignmentCollection.AddToCurrentScopeOnly
method is used to create any of the scopes.