共用方式為


SPFarm.CurrentUserIsAdministrator Method (Boolean)

Returns a Boolean value that indicates whether the current user is an administrator in the server farm.

Namespace:  Microsoft.SharePoint.Administration
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

Syntax

'Declaration
<SecurityPermissionAttribute(SecurityAction.Assert, Flags := SecurityPermissionFlag.ControlPrincipal)> _
Public Function CurrentUserIsAdministrator ( _
    allowContentApplicationAccess As Boolean _
) As Boolean
'Usage
Dim instance As SPFarm
Dim allowContentApplicationAccess As Boolean
Dim returnValue As Boolean

returnValue = instance.CurrentUserIsAdministrator(allowContentApplicationAccess)
[SecurityPermissionAttribute(SecurityAction.Assert, Flags = SecurityPermissionFlag.ControlPrincipal)]
public bool CurrentUserIsAdministrator(
    bool allowContentApplicationAccess
)

Parameters

  • allowContentApplicationAccess
    Type: System.Boolean

    true to make the check work in the content port of a Web application; otherwise, false.

Return Value

Type: System.Boolean
true if the current user is a server farm administrator; otherwise, false.

Remarks

This method is similar to CurrentUserIsAdministrator(), but allows the check to succeed on the content port.

Setting this value to true does not ensure any additional access needed. For example, operations that update the configuration database will still be blocked at a lower level. Additionally, setting the allowContentApplicationAccess parameter to true can dramatically impact the performance of this function and memory use on the server. Caution should be taken to avoid setting the allowContentApplicationAccess parameter to true on common page browses.

See Also

Reference

SPFarm Class

SPFarm Members

CurrentUserIsAdministrator Overload

Microsoft.SharePoint.Administration Namespace