SPRoleAssignmentCollection.AddToCurrentScopeOnly Method (Microsoft.SharePoint)

Switch View :
ScriptFree
SPRoleAssignmentCollection.AddToCurrentScopeOnly Method

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
Syntax

Visual Basic (Declaration)
Public Sub AddToCurrentScopeOnly ( _
	roleAssignment As SPRoleAssignment _
)
Visual Basic (Usage)
Dim instance As SPRoleAssignmentCollection
Dim roleAssignment As SPRoleAssignment

instance.AddToCurrentScopeOnly(roleAssignment)
C#
public void AddToCurrentScopeOnly(
	SPRoleAssignment roleAssignment
)

Parameters

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

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.

See Also

Reference

Community Content

Smartin75
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

Siew Moi Khor - MSFT
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.