I am using below code to query changes to users/OUs in AD. But it doesn\'t retrive any deleted objects, Any idea how to include deleted objects in this ?
sta
As for as my experience with SearchRequest the filter will not work at any cost, it has its own issue.. and to your case to get Deleted Objects changes you should use Domain Admin privileged account or something like that..
Here, you need to you give the privileged account who has complete rights over Deleted Objects container.
System.Net.NetworkCredential cr = new System.Net.NetworkCredential(@"administrator", "xxx", "xxx");
LdapConnection connection = new LdapConnection(str_dcName);
solution is need to add isDeleted=TRUE
to request object
SearchRequest request = new SearchRequest("DC=xx,DC=xxx,DC=com",
"(|(objectClass=organizationalUnit)(isDeleted=TRUE)(objectCategory=Person))",
SearchScope.Subtree, attribs);