Partager via


Octet String (SID) Property Type

In Active Directory Domain Services, properties that contain binary data are represented by octet strings. The String(Octet) and String(Sid) properties are used to represent these syntax types. System.DirectoryServices represents these binary data types as an array of Byte values. For more information about these properties, see the String(Octet) topic and the String(Sid) topic in the MSDN Library at https://go.microsoft.com/fwlink/?LinkID=27252.

The following example shows how to read the object SID property.

Dim usrSID As Byte() = CType(usr.Properties("objectSID").Value, Byte())
Dim b As Byte
For Each b In usrSID
    Console.Write("{0:x2}", b)
Next b
byte[] usrSID = (byte[])usr.Properties["objectSID"].Value;
foreach(byte b in usrSID)
{
    Console.Write("{0:x2}", b);
}

The following example shows how to write the object SID property.

Dim usrSID As Byte() = CType(usr.Properties("objectSid").Value, Byte())
usr.Properties("objectSid ").Clear()
usr.Properties("objectSid ").Value = usrSID
usr.CommitChanges()
byte[] usrSID = (byte[])usr.Properties["objectSid"].Value;
usr.Properties["objectSid "].Clear();
usr.Properties["objectSid "].Value = usrSID;
usr.CommitChanges();

See Also

Reference

System.DirectoryServices
Byte

Concepts

Property Types

Send comments about this topic to Microsoft.

Copyright © 2007 by Microsoft Corporation. All rights reserved.