Прочетете на английски Редактиране

Споделяне чрез


Principal.IsMemberOf Method

Definition

Returns a Boolean value that specifies whether the group is a member of the specified group.

Overloads

IsMemberOf(PrincipalContext, IdentityType, String)

Returns a Boolean value that specifies whether the principal is a member of the group specified by identity type and value.

IsMemberOf(GroupPrincipal)

Returns a Boolean value that specifies whether the principal is a member of the specified group.

IsMemberOf(PrincipalContext, IdentityType, String)

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

Returns a Boolean value that specifies whether the principal is a member of the group specified by identity type and value.

C#
public bool IsMemberOf(System.DirectoryServices.AccountManagement.PrincipalContext context, System.DirectoryServices.AccountManagement.IdentityType identityType, string identityValue);
C#
[System.Security.SecurityCritical]
public bool IsMemberOf(System.DirectoryServices.AccountManagement.PrincipalContext context, System.DirectoryServices.AccountManagement.IdentityType identityType, string identityValue);

Parameters

context
PrincipalContext

The PrincipalContext that specifies the server or domain against which operations are performed.

identityType
IdentityType

A IdentityType enumeration value that specifies the type of the identity value.

identityValue
String

The identity of the group.

Returns

true if the principal is a member of the specified group; otherwise false.

Attributes

Exceptions

The identity type or value does not correspond to a GroupPrincipal.

More than one matching GroupPrincipal was found.

Remarks

If the current principal is an AD DS principal, the returned groups include the principal's primary group, as indicated by the primary group ID attribute on the AD DS object.

Applies to

.NET 10 (package-provided) и други версии
Продукт Версии
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)

IsMemberOf(GroupPrincipal)

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

Returns a Boolean value that specifies whether the principal is a member of the specified group.

C#
public bool IsMemberOf(System.DirectoryServices.AccountManagement.GroupPrincipal group);
C#
[System.Security.SecurityCritical]
public bool IsMemberOf(System.DirectoryServices.AccountManagement.GroupPrincipal group);

Parameters

group
GroupPrincipal

The GroupPrincipal object for which principal membership is determined.

Returns

true if the principal is a member of the specified group; otherwise false.

Attributes

Exceptions

The GroupPrincipal specified in the group parameter could not be found.

More than one matching GroupPrincipal was found.

Remarks

If the current principal is an AD DS principal, the returned groups include the principal's primary group, as indicated by the primary group ID attribute on the AD DS object.

Applies to

.NET 10 (package-provided) и други версии
Продукт Версии
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)