共用方式為


SPList.DoesUserHavePermissions Method (SPBasePermissions, Boolean)

Indicates whether the current user has a specified set of permissions on the list and optionally checks permissions on the current folder.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
Public Function DoesUserHavePermissions ( _
    permissionMask As SPBasePermissions, _
    checkFolder As Boolean _
) As Boolean
'Usage
Dim instance As SPList
Dim permissionMask As SPBasePermissions
Dim checkFolder As Boolean
Dim returnValue As Boolean

returnValue = instance.DoesUserHavePermissions(permissionMask, _
    checkFolder)
public bool DoesUserHavePermissions(
    SPBasePermissions permissionMask,
    bool checkFolder
)

Parameters

  • checkFolder
    Type: System.Boolean

    true to check permissions against the current folder, either the list root folder or a folder within the list; otherwise, false.

Return Value

Type: System.Boolean
true if the user has the specified permissions; otherwise, false.

Exceptions

Exception Condition
UnauthorizedAccessException

The current user does not have the EnumeratePermissions right.

See Also

Reference

SPList Class

SPList Members

DoesUserHavePermissions Overload

Microsoft.SharePoint Namespace