DirectoryEntry problem with Credential

I’m using DirectoryEntry to access Active directory inside my Company.
We have 2 OrganizationUnit OU1 and OU2.
We have 2 uers:

  • User1 is enabled for OU1
  • User2 is enabled both for OU1 and OU2.

I’m logged in Windows with User1, and I need to use User2 to get from Active Directory the list of the Company Users, including both OU1 and OU2.
I’ve used DirectoryEntry constructor with Username, Pwd and AuthType, where I pass User2,
public DirectoryEntry (string path, string username, string password, System.DirectoryServices.AuthenticationTypes authenticationType);

I expected to acquire User2 credentials for getting Users of both the Organization Units, but I continue to retrieve only users for OU1.
I’ve tried also differenct combination for parameter authenticationType but nothing has changed.
Have you any suggestion?
Best regards,

I’ve found a solution impersonating User2 before of invoking the DirectorySearcher.FindAll,

Is there another way to do the same thing without impersonating User2?

Thank you,

.NET Foundation Website | Blog | Projects | Code of Conduct