Nota
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare ad accedere o modificare le directory.
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare a modificare le directory.
Le proprietà come l'attributo wellKnownObjects dello schema Active Directory utilizzano il tipo di sintassi Object(DN-Binary). Per ulteriori informazioni sull'attributo wellKnownObjects o il tipo di sintassi Object(DN-Binary), vedere gli argomenti relativi in MSDN Library all'indirizzo https://go.microsoft.com/fwlink/?LinkID=27252 (informazioni in lingua inglese).
Se si ottiene una proprietà che utilizza il tipo Object(DN-Binary) con la proprietà Properties, questo tipo di dati viene rappresentato come un oggetto COM a cui è possibile accedere dall'interfaccia IADsDNWithBinary. Per ulteriori informazioni su questa interfaccia, vedere la pagina relativa a IADsDNWithBinary in MSDN Library all'indirizzo https://go.microsoft.com/fwlink/?LinkID=27252. Se si ottiene una proprietà che utilizza il tipo Object(DN-Binary) da ResultPropertyValueCollection, questo tipo di dati viene rappresentato come un oggetto String contenente il nome distinto e i dati binari nel formato specificato dalla sintassi Object(DN-Binary).
Negli esempi riportati di seguito viene illustrato come leggere una proprietà che ha un valore che utilizza la sintassi basata su nome distinto con valore binario.
Imports ActiveDs
Dim wkObjects As [Object] = usr.Properties("wellKnownObjects").Value
Dim wkObject As DNWithBinary
For Each wkObject In CType(wkObjects, IEnumerable)
Dim bytes As Byte() = CType(wkObject.BinaryValue, Byte())
Dim b As Byte
For Each b In bytes
Console.Write("{0:x2}", b)
Next b
Console.WriteLine(wkObject.DNString)
Next wkObject
using ActiveDs;
Object wkObjects = ent.Properties["wellKnownObjects"].Value;
foreach(DNWithBinary wkObject in (IEnumerable) wkObjects)
{
byte[] bytes= (byte[]) wkObject.BinaryValue;
foreach(byte b in bytes)
{
Console.Write("{0:x2}",b);
}
Console.WriteLine(wkObject.DNString);
}
Negli esempi riportati di seguito viene illustrato come scrivere un valore di proprietà che utilizza la sintassi basata su nome distinto con valore binario.
Imports ActiveDs
Dim dnBin As New ActiveDs.DNWithBinaryClass()
dnBin.DNString = usr.Properties("distinguishedName").Value.ToString()
dnBin.BinaryValue = usr.Guid.ToByteArray()
usr.Properties("singleDNWithBinary").Value = dnBin
usr.CommitChanges()
using ActiveDs;
ActiveDs.DNWithBinary dnBin = new ActiveDs.DNWithBinaryClass();
dnBin.DNString = usr.Properties["distinguishedName"].Value.ToString();
dnBin.BinaryValue = usr.Guid.ToByteArray();
usr.Properties["singleDNWithBinary"].Value = dnBin;
usr.CommitChanges();
Vedere anche
Riferimenti
System.DirectoryServices
DirectoryEntry
ResultPropertyValueCollection
Concetti
Send comments about this topic to Microsoft.
Copyright © 2007 Microsoft Corporation. Tutti i diritti riservati.