dotnet / dotnet-api-docs

.NET API reference documentation (.NET 5+, .NET Core, .NET Framework)
https://docs.microsoft.com/dotnet/api/
Other
738 stars 1.57k forks source link

Search generating exception [Active Directory Recycle Bin] [DirectoryEntry] #10514

Open RikeGC opened 1 month ago

RikeGC commented 1 month ago

Type of issue

Missing information

Description

Hello everyone.

I'm trying to retrieve information about deleted objects in Active Directory. Typically, these objects are stored in the Active Directory recycle bin. I can perform searches using the DirectorySearcher class, but when I attempt to query the DirectoryEntry class using the same path from DirectorySearcher, I encounter exceptions for all fields.

String myADSPath = "LDAP:///CN=\0ADEL:,CN=Deleted Objects,DC=adomain,DC=br";

DirectoryEntry myDirectoryEntry = new DirectoryEntry(myADSPath, username, password);

string teste = myDirectoryEntry.Parent.Path;

imagem (40)

I can run the same query without any issues when it involves an active object. However, I'm encountering problems specifically with deleted objects. I would like to know if there are any alternative methods to investigate this issue. It's possible that there are permissions I might not have.

I tried to retrieve information about deleted objects in Active Directory using the DirectorySearcher class. My expectation was to successfully query the deleted objects stored in the Active Directory recycle bin, which would help me develop a restoration plan for these objects. However, when I attempted to use the same path from DirectorySearcher to query the DirectoryEntry class, I encountered exceptions for all fields.

Page URL

https://learn.microsoft.com/en-us/dotnet/api/system.directoryservices.directoryentry.parent?view=net-8.0#system-directoryservices-directoryentry-parent

Content source URL

https://github.com/dotnet/dotnet-api-docs/blob/main/xml/System.DirectoryServices/DirectoryEntry.xml

Document Version Independent Id

a0633bd1-abe0-958f-d0ed-966c01b7942c

Article author

@dotnet-bot

dotnet-issue-labeler[bot] commented 1 month ago

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

dotnet-issue-labeler[bot] commented 1 month ago

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.