Propriétés construites
Certains attributs d'annuaire sont construits. Les attributs construits ne peuvent pas être retournés dans une requête sauf si cela est spécifié. Si vous retournez un objet en utilisant la classe DirectoryEntry, vous pouvez utiliser la méthode RefreshCache pour récupérer les attributs construits. Si vous utilisez DirectorySearcher, vous utiliserez la propriété PropertiesToLoad pour spécifier les noms d'attributs, qui peuvent inclure un attribut construit.
L'exemple de code suivant montre comment lire la propriété construite allowedChildClasses.
Dim ent As New DirectoryEntry()
ent.RefreshCache(New String() {"allowedChildClasses"})
Dim prop As [String]
For Each prop In ent.Properties("allowedChildClasses")
Console.WriteLine(prop)
Next
DirectoryEntry ent = new DirectoryEntry();
ent.RefreshCache(new string[] {"allowedChildClasses"});
foreach(String prop in ent.Properties["allowedChildClasses"])
{
Console.WriteLine(prop);
}
L'exemple de code suivant montre comment écrire les propriétés construites en utilisant la propriété System.DirectoryServices.PropertyValueCollection.Value.
Dim ent As New DirectoryEntry()
ent.Properties("fsmoRoleOwner").Value = "CN=NTDS Settings,CN=FABRKM-DC-03,CN=Servers,CN=Bldg4,CN=Sites,CN=Configuration,DC=Fabrikam,DC=com"
ent.CommitChanges()
DirectoryEntry ent = new DirectoryEntry();
ent.Properties["fsmoRoleOwner"].Value =
"CN=NTDS Settings,CN=FABRKM-DC-03,CN=Servers,CN=Bldg4,CN=Sites,CN=Configuration,DC=Fabrikam,DC=com";
ent.CommitChanges();
Voir aussi
Référence
System.DirectoryServices
PropertyValueCollection
DirectoryEntry
DirectorySearcher
Concepts
Propriétés des objets d'annuaire
Send comments about this topic to Microsoft.
Copyright © 2007 par Microsoft Corporation. Tous droits réservés.