共用方式為


SPFarm.CurrentUserIsAdministrator Method

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
Public Function CurrentUserIsAdministrator As Boolean
'Usage
Dim instance As SPFarm
Dim returnValue As Boolean

returnValue = instance.CurrentUserIsAdministrator()
public bool CurrentUserIsAdministrator()

Return Value

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

Remarks

For security reasons, this will always return false in Web requests to Web applications other than the central administration site. To bypass this restriction, use the overload and set the allowContentApplicationAccess parameter to false.

See Also

Reference

SPFarm Class

SPFarm Members

CurrentUserIsAdministrator Overload

Microsoft.SharePoint.Administration Namespace