Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Properties such as the Active Directory Schema wellKnownObjects attribute use the Object(DN-Binary) syntax type. For more information about the wellKnownObjects attribute or the Object(DN-Binary) syntax type, see the topic "Well-Known-Objects attribute" or "Object(DN-Binary)" in the MSDN Library at https://go.microsoft.com/fwlink/?LinkID=27252.
If a property of this using the Object(DN-Binary) type is obtained with the Properties property, this data type is represented as a COM object that can be accessed with the IADsDNWithBinary interface. For more information about this interface, see the topic IADsDNWithBinary in the MSDN Library at https://go.microsoft.com/fwlink/?LinkID=27252. If a property using the Object(DN-Binary) type is obtained from a ResultPropertyValueCollection, this data type is represented as a String object that contains the distinguished name and binary data in the format that is specified by the Object(DN-Binary) syntax.
The following examples show how to read a property that has a value that uses the DN with binary syntax.
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);
}
The following examples show how to write a property value that uses the DN with binary syntax.
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();
See Also
Reference
System.DirectoryServices
DirectoryEntry
ResultPropertyValueCollection
Concepts
Send comments about this topic to Microsoft.
Copyright © 2007 by Microsoft Corporation. All rights reserved.