Bewerken

Share via


Principal.GetGroups Method

Definition

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

Overloads

GetGroups()

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

GetGroups(PrincipalContext)

Returns a collection of group objects that the principal is a member of and that exist in the store provided by the specified context parameter.

Remarks

This overloaded method only returns 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.

If the principal store is AD DS, the list of groups contains the user's primary group that is identified by the primary group ID attribute in the AD DS object.

GetGroups()

Source:
Principal.cs
Source:
Principal.cs
Source:
Principal.cs

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

public:
 System::DirectoryServices::AccountManagement::PrincipalSearchResult<System::DirectoryServices::AccountManagement::Principal ^> ^ GetGroups();
public System.DirectoryServices.AccountManagement.PrincipalSearchResult<System.DirectoryServices.AccountManagement.Principal> GetGroups ();
[System.Security.SecurityCritical]
public System.DirectoryServices.AccountManagement.PrincipalSearchResult<System.DirectoryServices.AccountManagement.Principal> GetGroups ();
member this.GetGroups : unit -> System.DirectoryServices.AccountManagement.PrincipalSearchResult<System.DirectoryServices.AccountManagement.Principal>
[<System.Security.SecurityCritical>]
member this.GetGroups : unit -> System.DirectoryServices.AccountManagement.PrincipalSearchResult<System.DirectoryServices.AccountManagement.Principal>
Public Function GetGroups () As PrincipalSearchResult(Of Principal)

Returns

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

Attributes

Remarks

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.

See also

Applies to

GetGroups(PrincipalContext)

Source:
Principal.cs
Source:
Principal.cs
Source:
Principal.cs

Returns a collection of group objects that the principal is a member of and that exist in the store provided by the specified context parameter.

public:
 System::DirectoryServices::AccountManagement::PrincipalSearchResult<System::DirectoryServices::AccountManagement::Principal ^> ^ GetGroups(System::DirectoryServices::AccountManagement::PrincipalContext ^ contextToQuery);
public System.DirectoryServices.AccountManagement.PrincipalSearchResult<System.DirectoryServices.AccountManagement.Principal> GetGroups (System.DirectoryServices.AccountManagement.PrincipalContext contextToQuery);
[System.Security.SecurityCritical]
public System.DirectoryServices.AccountManagement.PrincipalSearchResult<System.DirectoryServices.AccountManagement.Principal> GetGroups (System.DirectoryServices.AccountManagement.PrincipalContext contextToQuery);
member this.GetGroups : System.DirectoryServices.AccountManagement.PrincipalContext -> System.DirectoryServices.AccountManagement.PrincipalSearchResult<System.DirectoryServices.AccountManagement.Principal>
[<System.Security.SecurityCritical>]
member this.GetGroups : System.DirectoryServices.AccountManagement.PrincipalContext -> System.DirectoryServices.AccountManagement.PrincipalSearchResult<System.DirectoryServices.AccountManagement.Principal>
Public Function GetGroups (contextToQuery As PrincipalContext) As PrincipalSearchResult(Of Principal)

Parameters

contextToQuery
PrincipalContext

The PrincipalContext object that specifies the context against which the query is performed.

When the context is located in another domain, the query is performed against the principal objects' representation in the specified context.

Returns

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

Attributes

Remarks

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 primary group ID attribute on the AD DS object.

See also

Applies to