バイナリを持つ DN プロパティ型
Active Directory Schema wellKnownObjects 属性などのプロパティは、Object(DN-Binary) 構文型を使用します。wellKnownObjects 属性または Object(DN-Binary) 構文型の詳細については、MSDN ライブラリ (https://go.microsoft.com/fwlink/?LinkID=27252) で Well-Known-Objects 属性または Object(DN-Binary) に関するトピックを参照してください。
Object(DN-Binary) 型を使用するプロパティが Properties プロパティで取得される場合、このデータ型は IADsDNWithBinary インターフェイスでアクセスできる COM オブジェクトとして表されます。このインターフェイスの詳細については、MSDN ライブラリ (https://go.microsoft.com/fwlink/?LinkID=27252) で IADsDNWithBinary に関するトピックを参照してください。Object(DN-Binary) 型を使用するプロパティが ResultPropertyValueCollection から取得される場合、このデータ型は、Object(DN-Binary) 構文で指定された形式の識別名とバイナリ データを含む String オブジェクトとして表されます。
次の例は、バイナリを持つ DN 構文を使用する値を持つプロパティの読み取り方法を示しています。
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);
}
次の例は、バイナリを持つ DN 構文を使用するプロパティ値の書き込み方法を示しています
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();
関連項目
リファレンス
System.DirectoryServices
DirectoryEntry
ResultPropertyValueCollection
概念
Send comments about this topic to Microsoft.
Copyright © 2007 by Microsoft Corporation. All rights reserved.