Mar 03, 2014 08:31 AM|venkatzeus|LINK
I have tried the below, but still the "Security Group" is not found
DirectoryEntry entry = new DirectoryEntry(LDAPAddress, username, Password);
DirectorySearcher mySearcher = new DirectorySearcher(entry);
mySearcher.Filter = "(&(objectClass=user)(|(cn=" + strUserName + ")(sAMAccountName=" + strUserName + ")))";
SearchResult result = mySearcher.FindOne();
if (result != null)
foreach (string GroupPath in result.Properties["memberOf"])
I have also tried the code from : http://snipplr.com/view/31116/
But the same result.
The method "GetAuthorizationGroups" at times works and it finds the Group which I am looking for. However 70% of the time, I get the Object reference not set error.