共用方式為


八位元字串 (SID) 屬性型別

在 Active Directory 網域服務中,包含二進位資料的屬性會以八位元字串表示。String(Octet) 與 String(Sid) 屬性可用來表示這些語法類型。System.DirectoryServices 將這些二進位資料類型以 Byte 值陣列表示。如需有關這些屬性的詳細資訊,請參閱 MSDN Library (https://go.microsoft.com/fwlink/?LinkID=27252 (本頁面可能為英文)) 中的<String(Octet)>與<String(Sid)>主題。

下列程式碼範例示範如何讀取物件 SID 屬性。

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);
}

下列程式碼範例示範如何寫入物件 SID 屬性。

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();

請參閱

參考

System.DirectoryServices
Byte

概念

屬性型別

Send comments about this topic to Microsoft.

Copyright © 2007 by Microsoft Corporation.All rights reserved.