locked
DeleteTree Access Denied exception RRS feed

  • Question

  • We are using C#.NET 2.0 (Visual Studio 2005) System.DirectoryServices DirectoryEntry class to delete AD user accounts. The method DeleteTree() works fine so long as the user does not have a mailbox. With a mailbox however, the DeleteTree() throws an exception: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)). The service from where the method is executed impersonates a delegated user account that does have the Exchange Full Administrator rights. I notice in Exchange System Manager under Servers, the security tab for the speific server where mailstore is located, does show all of the rights under "Allow" column selected including the DeleteTree right. Yet I receive this access denied exception. We are able to manually delete the account from ADUC however. Please advise how to make this DeleteTree() work for mailbox enabled accounts.

    Thanks.
    Friday, January 2, 2009 7:48 PM

Answers