次の方法で共有


GUID を使用したバインド

ディレクトリ オブジェクトは移動されることがあるので、オブジェクトの識別名は、そのオブジェクトへの新しいパスを反映して変更されることがあります。アプリケーションでオブジェクトへの参照を保持する必要がある場合は、GUID を使用してそのオブジェクトにバインドします。ここでは、GUID を取得し、その GUID を使用してオブジェクトに再バインドする方法を示しています。

オブジェクトに割り当てられている GUID を取得するには、DirectoryEntry クラスで提供される NativeGuid プロパティを使用します。次のコード例は、NativeGuid プロパティの使用方法を示しています。

Dim ent As New DirectoryEntry()
Dim ADGuid As [String] = ent.NativeGuid
' Rebind using ADGuid.
Dim x As New DirectoryEntry("LDAP://<GUID=" + ADGuid + ">")
Console.WriteLine("These should be the same: {0} == {1}", ent.Name, x.Name)
DirectoryEntry ent = new DirectoryEntry();
String ADGuid = ent.NativeGuid;
// Rebind using ADGuid.
DirectoryEntry x = new DirectoryEntry("LDAP://<GUID="+ADGuid+">");
Console.WriteLine("These should be the same: {0} == {1}", ent.Name,x.Name);

関連項目

リファレンス

System.DirectoryServices
DirectoryEntry

概念

ディレクトリ オブジェクトへのバインド

Send comments about this topic to Microsoft.

Copyright © 2007 by Microsoft Corporation. All rights reserved.