GetAuthorizationGroups Method

UserPrincipal.GetAuthorizationGroups Method ()

.NET Framework (current version)
 

Returns a collection of principal objects that contains all the authorization groups of which this user is a member. This function only returns groups that are security groups; distribution groups are not returned.

Namespace:   System.DirectoryServices.AccountManagement
Assembly:  System.DirectoryServices.AccountManagement (in System.DirectoryServices.AccountManagement.dll)

public PrincipalSearchResult<Principal> GetAuthorizationGroups()

Return Value

Type: System.DirectoryServices.AccountManagement.PrincipalSearchResult<Principal>

A collection of Principal objects that contain the groups of which the user is a member, or null if the user does not belong to any groups.

Exception Condition
PrincipalOperationException

The attempt to retrieve authorization groups failed.

T:System>NotSupportedException

The retrieval of authorization groups is not supported by this operating system.

This method searches all groups recursively and returns the groups in which the user is a member. The returned set may also include additional groups that system would consider the user a member of for authorization purposes.

The groups that are returned by this method may include groups from a different scope and store than the principal. For example, if the principal is an AD DS object that has a DN of "CN=SpecialGroups,DC=Fabrikam,DC=com, the returned set can contain groups that belong to the "CN=NormalGroups,DC=Fabrikam,DC=com.

.NET Framework
Available since 3.5
Return to top
Show:
© 2016 Microsoft