Uisng this code
ArrayList myItems = new ArrayList();
UserPrincipal oUserPrincipal = GetUser(sUserName);
PrincipalSearchResult<Principal> oPrincipalSearchResult = oUserPrincipal.GetGroups(GetPrincipalContext(sOU));
foreach (Principal oResult in oPrincipalSearchResult)
{
myItems.Add(oResult.Name);
}
return myItems;
I am getting an error -2147016672 "An operations error occured", tried to google it and I cannot find any answer. It happens on this line oUserPrincipal.GetGroups(GetPrincipalContext(sOU)) but it continues on to the foreach and does not throw any error and continues but if you dont place try and catch then it shows you the exception. Any ideas?
ADDITIONAL INFO
TO add into it if I use oUserPrincipal.GetGroups() without passing an OU, everything works fine.