PrincipalCollection.Add Méthode
Définition
Ajoute l'entité de sécurité spécifiée à la fin de la collection.Adds the specified principal to the end of the collection.
Surcharges
Add(ComputerPrincipal) |
Ajoute l'objet ComputerPrincipal spécifié à la fin de la collection.Adds the specified ComputerPrincipal object to the end of the collection. |
Add(GroupPrincipal) |
Ajoute l'objet GroupPrincipal spécifié à la fin de la collection.Adds the specified GroupPrincipal object to the end of the collection. |
Add(Principal) |
Ajoute l'objet Principal spécifié à la fin de la collection.Adds the specified Principal object to the end of the collection. |
Add(UserPrincipal) |
Ajoute l'objet UserPrincipal spécifié à la fin de la collection.Adds the specified UserPrincipal object to the end of the collection. |
Add(PrincipalContext, IdentityType, String) |
Recherche un objet Principal qui correspond aux paramètres et l'ajoute à la fin de la collection.Searches for a Principal object that matches the parameters, and adds it to the end of the collection. |
Remarques
Comme avec Remove et Contains, il y a quatre surcharges de cette fonction, mais elles ont toutes la même signification.As with Remove and Contains, There are four overloads to this function, but they all do the same thing. Les surcharges supplémentaires sont uniquement implémentées pour améliorer la convivialité, afin que les développeurs qui utilisent IntelliSense voient des surcharges qui prennent un objet UserPrincipal, GroupPrincipal ou ComputerPrincipal.The extra overloads are only implemented to improve usability, so that developers using IntelliSense see overloads that take a UserPrincipal, GroupPrincipal, or ComputerPrincipal object. L’appel de l’un des surcharges d’utilisateur, de groupe ou d’ordinateur équivaut exactement à l’appel de la surcharge Principal.Calling any one of the User, Group, or Computer overloads is exactly equivalent to calling the Principal overload.
Add(ComputerPrincipal)
Ajoute l'objet ComputerPrincipal spécifié à la fin de la collection.Adds the specified ComputerPrincipal object to the end of the collection.
public:
void Add(System::DirectoryServices::AccountManagement::ComputerPrincipal ^ computer);
[System.Security.SecurityCritical]
public void Add (System.DirectoryServices.AccountManagement.ComputerPrincipal computer);
member this.Add : System.DirectoryServices.AccountManagement.ComputerPrincipal -> unit
Public Sub Add (computer As ComputerPrincipal)
Paramètres
- computer
- ComputerPrincipal
Objet ComputerPrincipal.A ComputerPrincipal object.
- Attributs
Remarques
Cette fonction peut lever les exceptions suivantes :This function can throw the following exceptions:
ExceptionException | DescriptionDescription |
---|---|
PrincipalExistsException | computer existe déjà dans la collection.computer already exists in the collection. |
Add(GroupPrincipal)
Ajoute l'objet GroupPrincipal spécifié à la fin de la collection.Adds the specified GroupPrincipal object to the end of the collection.
public:
void Add(System::DirectoryServices::AccountManagement::GroupPrincipal ^ group);
[System.Security.SecurityCritical]
public void Add (System.DirectoryServices.AccountManagement.GroupPrincipal group);
member this.Add : System.DirectoryServices.AccountManagement.GroupPrincipal -> unit
Public Sub Add (group As GroupPrincipal)
Paramètres
- group
- GroupPrincipal
Objet ComputerPrincipal.A ComputerPrincipal object.
- Attributs
Remarques
Cette fonction peut lever les exceptions suivantes :This function can throw the following exceptions:
ExceptionException | DescriptionDescription |
---|---|
PrincipalExistsException | group existe déjà dans la collection.group already exists in the collection. |
Add(Principal)
Ajoute l'objet Principal spécifié à la fin de la collection.Adds the specified Principal object to the end of the collection.
public:
virtual void Add(System::DirectoryServices::AccountManagement::Principal ^ principal);
[System.Security.SecurityCritical]
public void Add (System.DirectoryServices.AccountManagement.Principal principal);
abstract member Add : System.DirectoryServices.AccountManagement.Principal -> unit
override this.Add : System.DirectoryServices.AccountManagement.Principal -> unit
Paramètres
Implémente
- Attributs
Remarques
Cette fonction peut lever les exceptions suivantes :This function can throw the following exceptions:
ExceptionException | DescriptionDescription |
---|---|
PrincipalExistsException | principal existe déjà dans la collection.principal already exists in the collection. |
Add(UserPrincipal)
Ajoute l'objet UserPrincipal spécifié à la fin de la collection.Adds the specified UserPrincipal object to the end of the collection.
public:
void Add(System::DirectoryServices::AccountManagement::UserPrincipal ^ user);
[System.Security.SecurityCritical]
public void Add (System.DirectoryServices.AccountManagement.UserPrincipal user);
member this.Add : System.DirectoryServices.AccountManagement.UserPrincipal -> unit
Public Sub Add (user As UserPrincipal)
Paramètres
- user
- UserPrincipal
Objet UserPrincipalA UserPrincipal object
- Attributs
Remarques
Cette fonction peut lever les exceptions suivantes :This function can throw the following exceptions:
ExceptionException | DescriptionDescription |
---|---|
PrincipalExistsException | user existe déjà dans la collection.user already exists in the collection. |
Add(PrincipalContext, IdentityType, String)
Recherche un objet Principal qui correspond aux paramètres et l'ajoute à la fin de la collection.Searches for a Principal object that matches the parameters, and adds it to the end of the collection.
public:
void Add(System::DirectoryServices::AccountManagement::PrincipalContext ^ context, System::DirectoryServices::AccountManagement::IdentityType identityType, System::String ^ identityValue);
[System.Security.SecurityCritical]
public void Add (System.DirectoryServices.AccountManagement.PrincipalContext context, System.DirectoryServices.AccountManagement.IdentityType identityType, string identityValue);
member this.Add : System.DirectoryServices.AccountManagement.PrincipalContext * System.DirectoryServices.AccountManagement.IdentityType * string -> unit
Paramètres
- context
- PrincipalContext
Objet PrincipalContext pour l'entité de sécurité à ajouter à la collection.The PrincipalContext object for the principal to be added to the collection.
- identityType
- IdentityType
Objet IdentityType qui spécifie le format de identityValue
.An IdentityType object that specifies the format of identityValue
- identityValue
- String
Chaîne qui identifie l'entité de sécurité dans le format spécifié par identityType
.A string that identifies the principal, in the format specified by identityType
- Attributs
Remarques
Cette fonction peut lever les exceptions suivantes :This function can throw the following exceptions:
ExceptionException | DescriptionDescription |
---|---|
PrincipalExistsException | Le principal correspondant à ces paramètres existe déjà dans la collection.The principal matching these parameters already exists in the collection. |
NoMatchingPrincipalException | Aucun principal correspondant aux paramètres spécifiés n’a été trouvé.No principal matching the specified parameters was found. |
MultipleMatchesException | Plus d’un principal correspond aux paramètres spécifiés.More than one principal matches the specified parameters. |
ArgumentException | identityType est une chaîne vide.identityType is an empty string |