SPPermissionCollection.RequestAccess Property
NOTE: This API is now obsolete.
Gets or sets a Boolean value that specifies whether request for access is enabled for a list.
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
Syntax
'Declaration
<ObsoleteAttribute("Use the SPRoleAssignmentCollection class instead")> _
Public Property RequestAccess As Boolean
Get
Set
'Usage
Dim instance As SPPermissionCollection
Dim value As Boolean
value = instance.RequestAccess
instance.RequestAccess = value
[ObsoleteAttribute("Use the SPRoleAssignmentCollection class instead")]
public bool RequestAccess { get; set; }
Property Value
Type: System.Boolean
true if request for access is enabled for the list; otherwise, false.
Remarks
The RequestAccess property applies to the permissions for a single list; the RequestAccessEmail property applies to the permissions for an entire site. If the RequestAccessEmail property contains an empty string, request for access cannot be enabled for a list.
Examples
The following code example enables request for access on a site, but removes request for access from all lists except the list with a specified title.
Dim site As SPWeb = SPContext.Current.Web
Dim permsSite As SPPermissionCollection = site.Permissions
permsSite.RequestAccessEmail = "Email_Address"
Dim lists As SPListCollection = site.Lists
Dim list As SPList
For Each list In lists
If list.Hidden <> True Then
If list.Title <> "List_Title" Then
Dim permsList As SPPermissionCollection = list.Permissions
permsList.RequestAccess = False
End If
End If
Next list
SPWeb oWebsite = SPContext.Current.Web;
SPPermissionCollection collPermissions = oWebsite.Permissions;
collPermissions.RequestAccessEmail = "Email_Address";
SPListCollection collLists = oWebsite.Lists;
foreach (SPList oList in collLists)
{
if (oList.Hidden != true)
{
if (oList.Title != "List_Title")
{
SPPermissionCollection collPermissions =
oPermission.Permissions;
collPermissions.RequestAccess = false;
}
}
}