Nota
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare ad accedere o modificare le directory.
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare a modificare le directory.
Per spostare gli oggetti in un nuovo contenitore, utilizzare il metodo MoveTo.
Nell'esempio riportato di seguito viene illustrato come utilizzare il metodo MoveTo per spostare un oggetto utente.
Try
' Bind to the object to be moved.
Dim NewUser As New DirectoryEntry("LDAP://CN=User Name,OU=Sales,DC=fabrikam,DC=com")
' Use the MoveTo property to define the new container you want to move the object to.
NewUser.MoveTo(New DirectoryEntry("LDAP://OU=HR,DC=fabrikam,DC=com"))
Catch InvOpEx As InvalidOperationException
' Handle InvalidOperationException.
Console.WriteLine(InvOpEx.Message);
Catch COMEx As COMException
' Handle COMException.
' For more information about handling COM exceptions, see Handling Errors.
Console.WriteLine(COMEx.Message);
End Try
try
{
// Bind to the object to be moved.
DirectoryEntry NewUser = new DirectoryEntry("LDAP://CN=User Name,OU=Sales,DC=fabrikam,DC=com");
// Use the MoveTo property to define the new container you want to move the object to.
NewUser.MoveTo( new DirectoryEntry("LDAP://OU=HR,DC=fabrikam,DC=com"));
}
catch (InvalidOperationException InvOpEx)
{
// Handle InvalidOperationException.
Console.WriteLine(InvOpEx.Message);
}
catch (COMException COMEx)
{
// Handle COMException.
// For more information about handling COM exceptions, see Handling Errors.
Console.WriteLine(COMEx.Message);
}
Vedere anche
Riferimenti
System.DirectoryServices
DirectoryEntry
Concetti
Creazione, eliminazione, ridenominazione e spostamento di oggetti
Send comments about this topic to Microsoft.
Copyright © 2007 Microsoft Corporation. Tutti i diritti riservati.