Principal.GetGroups Method ()

 

Returns a collection of group objects that specify the groups of which the current principal is a member.

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

[SecurityCriticalAttribute]
public PrincipalSearchResult<Principal> GetGroups()

Return Value

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

A collection of GroupPrincipal objects that specify the groups of which the current principal is a member.

This method returns only the groups of which the principal is directly a member; no recursive searches are performed. Recursive search results are available for user principal objects. For more information, see the GetAuthorizationGroups method.

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.

If the current principal is an AD DS principal, the returned groups include the principals primary group, as indicated by the "primaryGroupId" attribute on the AD DS object.

.NET Framework
Available since 3.5

System.DirectoryServices.AccountManagement
GetGroups
GetGroups Overload
Principal Class
System.DirectoryServices.AccountManagement Namespace Overview

Return to top
Show: