PrincipalCollection.Remove Metod

Definition

Tar bort det angivna huvudkontot från samlingen och returnerar true om det angivna huvudobjektet var medlem i samlingen och false i annat fall (i vilket fall ingen åtgärd utförs).

Överlagringar

Name Description
Remove(ComputerPrincipal)

Tar bort det angivna ComputerPrincipal objektet från samlingen och returnerar true om ComputerPrincipal var medlem i den här PrincipalCollection, och false i annat fall (i vilket fall metoden inte utför någon åtgärd).

Remove(GroupPrincipal)

Tar bort det angivna GroupPrincipal objektet från samlingen och returnerar true om GroupPrincipal var medlem i den här PrincipalCollection, och false i annat fall (i vilket fall metoden inte utför någon åtgärd).

Remove(Principal)

Tar bort det angivna Principal objektet från samlingen och returnerar true om Principal var medlem i den här PrincipalCollection, och false i annat fall (i vilket fall metoden inte utför någon åtgärd).

Remove(UserPrincipal)

Tar bort det angivna UserPrincipal objektet från samlingen och returnerar true om UserPrincipal var medlem i den här PrincipalCollection, och false i annat fall (i vilket fall metoden inte utför någon åtgärd).

Remove(PrincipalContext, IdentityType, String)

Hittar objektet UserPrincipal som anges av angivet PrincipalContext och identityType/identityValue par från samlingen och returnerar true om den identifierade Principal var medlem i den här PrincipalCollection, och false i annat fall (i vilket fall metoden inte utför någon åtgärd).

Kommentarer

Precis som med Add, och Contains det finns fyra överlagringar till den här funktionen, men de gör alla samma sak. De extra överlagringarna implementeras bara för att förbättra användbarheten, så att utvecklare som använder IntelliSense ser överlagringar som tar ett UserPrincipal, GroupPrincipaleller ComputerPrincipal -objekt. Att anropa någon av överlagringarna användare, grupp eller dator motsvarar exakt överbelastningen Principal .

Remove(ComputerPrincipal)

Källa:
PrincipalCollection.cs
Källa:
PrincipalCollection.cs
Källa:
PrincipalCollection.cs
Källa:
PrincipalCollection.cs

Tar bort det angivna ComputerPrincipal objektet från samlingen och returnerar true om ComputerPrincipal var medlem i den här PrincipalCollection, och false i annat fall (i vilket fall metoden inte utför någon åtgärd).

public:
 bool Remove(System::DirectoryServices::AccountManagement::ComputerPrincipal ^ computer);
public bool Remove(System.DirectoryServices.AccountManagement.ComputerPrincipal computer);
[System.Security.SecurityCritical]
public bool Remove(System.DirectoryServices.AccountManagement.ComputerPrincipal computer);
member this.Remove : System.DirectoryServices.AccountManagement.ComputerPrincipal -> bool
[<System.Security.SecurityCritical>]
member this.Remove : System.DirectoryServices.AccountManagement.ComputerPrincipal -> bool
Public Function Remove (computer As ComputerPrincipal) As Boolean

Parametrar

computer
ComputerPrincipal

Ett ComputerPrincipal objekt.

Returer

true om var medlem i ComputerPrincipal detta PrincipalCollection, annars , false.

Attribut

Kommentarer

Den här funktionen kan utlösa följande undantag:

Exception Description
InvalidOperationException Den här metoden anropades Members för samlingen för en domängrupp och domänobjektet som ska tas bort är medlem i gruppen med hjälp av dess primaryGroupId attribut.

Gäller för

Remove(GroupPrincipal)

Källa:
PrincipalCollection.cs
Källa:
PrincipalCollection.cs
Källa:
PrincipalCollection.cs
Källa:
PrincipalCollection.cs

Tar bort det angivna GroupPrincipal objektet från samlingen och returnerar true om GroupPrincipal var medlem i den här PrincipalCollection, och false i annat fall (i vilket fall metoden inte utför någon åtgärd).

public:
 bool Remove(System::DirectoryServices::AccountManagement::GroupPrincipal ^ group);
public bool Remove(System.DirectoryServices.AccountManagement.GroupPrincipal group);
[System.Security.SecurityCritical]
public bool Remove(System.DirectoryServices.AccountManagement.GroupPrincipal group);
member this.Remove : System.DirectoryServices.AccountManagement.GroupPrincipal -> bool
[<System.Security.SecurityCritical>]
member this.Remove : System.DirectoryServices.AccountManagement.GroupPrincipal -> bool
Public Function Remove (group As GroupPrincipal) As Boolean

Parametrar

group
GroupPrincipal

Ett GroupPrincipal objekt.

Returer

true om var medlem i GroupPrincipal detta PrincipalCollection, annars , false.

Attribut

Kommentarer

Den här funktionen kan utlösa följande undantag:

Exception Description
InvalidOperationException Den här metoden anropades Members för samlingen för en domängrupp och domänobjektet som ska tas bort är medlem i gruppen med hjälp av dess primaryGroupId attribut.

Gäller för

Remove(Principal)

Källa:
PrincipalCollection.cs
Källa:
PrincipalCollection.cs
Källa:
PrincipalCollection.cs
Källa:
PrincipalCollection.cs

Tar bort det angivna Principal objektet från samlingen och returnerar true om Principal var medlem i den här PrincipalCollection, och false i annat fall (i vilket fall metoden inte utför någon åtgärd).

public:
 virtual bool Remove(System::DirectoryServices::AccountManagement::Principal ^ principal);
public bool Remove(System.DirectoryServices.AccountManagement.Principal principal);
[System.Security.SecurityCritical]
public bool Remove(System.DirectoryServices.AccountManagement.Principal principal);
abstract member Remove : System.DirectoryServices.AccountManagement.Principal -> bool
override this.Remove : System.DirectoryServices.AccountManagement.Principal -> bool
[<System.Security.SecurityCritical>]
abstract member Remove : System.DirectoryServices.AccountManagement.Principal -> bool
override this.Remove : System.DirectoryServices.AccountManagement.Principal -> bool
Public Function Remove (principal As Principal) As Boolean

Parametrar

principal
Principal

Ett Principal objekt.

Returer

true om var medlem i Principal detta PrincipalCollection, annars , false.

Implementeringar

Attribut

Kommentarer

Den här funktionen kan utlösa följande undantag:

Exception Description
InvalidOperationException Den här metoden anropades Members för samlingen för en domängrupp och domänobjektet som ska tas bort är medlem i gruppen med hjälp av dess primaryGroupId attribut.

Gäller för

Remove(UserPrincipal)

Källa:
PrincipalCollection.cs
Källa:
PrincipalCollection.cs
Källa:
PrincipalCollection.cs
Källa:
PrincipalCollection.cs

Tar bort det angivna UserPrincipal objektet från samlingen och returnerar true om UserPrincipal var medlem i den här PrincipalCollection, och false i annat fall (i vilket fall metoden inte utför någon åtgärd).

public:
 bool Remove(System::DirectoryServices::AccountManagement::UserPrincipal ^ user);
public bool Remove(System.DirectoryServices.AccountManagement.UserPrincipal user);
[System.Security.SecurityCritical]
public bool Remove(System.DirectoryServices.AccountManagement.UserPrincipal user);
member this.Remove : System.DirectoryServices.AccountManagement.UserPrincipal -> bool
[<System.Security.SecurityCritical>]
member this.Remove : System.DirectoryServices.AccountManagement.UserPrincipal -> bool
Public Function Remove (user As UserPrincipal) As Boolean

Parametrar

user
UserPrincipal

Ett UserPrincipal objekt.

Returer

true om var medlem i UserPrincipal detta PrincipalCollection, annars , false.

Attribut

Kommentarer

Den här funktionen kan utlösa följande undantag:

Exception Description
InvalidOperationException Den här metoden anropades Members för samlingen för en domängrupp och domänobjektet som ska tas bort är medlem i gruppen med hjälp av dess primaryGroupId attribut.

Gäller för

Remove(PrincipalContext, IdentityType, String)

Källa:
PrincipalCollection.cs
Källa:
PrincipalCollection.cs
Källa:
PrincipalCollection.cs
Källa:
PrincipalCollection.cs

Hittar objektet UserPrincipal som anges av angivet PrincipalContext och identityType/identityValue par från samlingen och returnerar true om den identifierade Principal var medlem i den här PrincipalCollection, och false i annat fall (i vilket fall metoden inte utför någon åtgärd).

public:
 bool Remove(System::DirectoryServices::AccountManagement::PrincipalContext ^ context, System::DirectoryServices::AccountManagement::IdentityType identityType, System::String ^ identityValue);
public bool Remove(System.DirectoryServices.AccountManagement.PrincipalContext context, System.DirectoryServices.AccountManagement.IdentityType identityType, string identityValue);
[System.Security.SecurityCritical]
public bool Remove(System.DirectoryServices.AccountManagement.PrincipalContext context, System.DirectoryServices.AccountManagement.IdentityType identityType, string identityValue);
member this.Remove : System.DirectoryServices.AccountManagement.PrincipalContext * System.DirectoryServices.AccountManagement.IdentityType * string -> bool
[<System.Security.SecurityCritical>]
member this.Remove : System.DirectoryServices.AccountManagement.PrincipalContext * System.DirectoryServices.AccountManagement.IdentityType * string -> bool
Public Function Remove (context As PrincipalContext, identityType As IdentityType, identityValue As String) As Boolean

Parametrar

context
PrincipalContext

Ett PrincipalContext objekt.

identityType
IdentityType

En IdentityType som identifierar formatet identityValueför .

identityValue
String

En sträng.

Returer

true om den identifierade Principal var medlem i detta PrincipalCollection, annars , false.

Attribut

Kommentarer

Den här funktionen kan utlösa följande undantag:

Exception Description
InvalidOperationException Den här metoden anropades Members för samlingen för en domängrupp och domänobjektet som ska tas bort är medlem i gruppen med hjälp av dess primaryGroupId attribut.
NoMatchingPrincipalException Inget huvudnamn som matchar de angivna parametrarna hittades.
MultipleMatchesException Mer än ett huvudnamn matchar de angivna parametrarna. I teorin bör detta aldrig inträffa, eftersom Add genererar ett undantag när det görs ett försök att lägga till duplicerade huvudnamn i samlingen. Det är dock möjligt att ett annat API skapade dubbletten.
ArgumentException identityType är en tom sträng.

Gäller för