Export (0) Print
Expand All

DirectoryEntry.NativeGuid Property

Gets the globally unique identifier of the DirectoryEntry, as returned from the provider.

[Visual Basic]
Public ReadOnly Property NativeGuid As String
[C#]
public string NativeGuid {get;}
[C++]
public: __property String* get_NativeGuid();
[JScript]
public function get NativeGuid() : String;

Property Value

The globally unique identifier of the DirectoryEntry, as returned from the provider.

Remarks

Use the NativeGuid property when binding an object in Active Directory.

Note   The Lightweight Directory Access Protocol (LDAP) provider returns the globally unique identifier of a DirectoryEntry in a different format than the Internet Information Services (IIS), Novell NetWare Directory Server (NDS), and WinNT providers.

Example

[Visual Basic, C#, C++] The following example demonstrates the Guid and NativeGuid properties of the DirectoryEntry class. This example gets the user-specified DirectoryEntry and displays its Guid and NativeGuid properties.

[Visual Basic] 
Dim myADSPath As [String] = "LDAP://onecity/CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com"
Dim myDirectoryEntry As New DirectoryEntry(myADSPath)

' Display the Guid and NativeGuid.
Console.WriteLine("The GUID of the ADS object:" + myDirectoryEntry.Guid.ToString)
Console.WriteLine("The Native GUID of the ADS" + "object:" + myDirectoryEntry.NativeGuid)

[C#] 
String myADSPath = "LDAP://onecity/CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com";
DirectoryEntry myDirectoryEntry=new DirectoryEntry(myADSPath);

// Display the Guid and NativeGuid.
Console.WriteLine("The GUID of the ADS object:"+
                  myDirectoryEntry.Guid);
Console.WriteLine("The Native GUID of the ADS"+
                  "object:"+myDirectoryEntry.NativeGuid);

[C++] 
String* myADSPath = S"LDAP://onecity/CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com";
DirectoryEntry* myDirectoryEntry = new DirectoryEntry(myADSPath);

// Display the Guid and NativeGuid.
Console::WriteLine("The GUID of the ADS object: {0}", __box(myDirectoryEntry->Guid));
Console::WriteLine("The Native GUID of the ADS object: {0}",
                   myDirectoryEntry->NativeGuid);

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

DirectoryEntry Class | DirectoryEntry Members | System.DirectoryServices Namespace | DirectoryEntry.Guid | Guid

Show:
© 2014 Microsoft