PrincipalContext context = new PrincipalContext(ContextType.Domain, "ipofmachine", "DC=xyz,DC=org", "username", "Password");
UserPrincipal userPrinciple = UserPrincipal.FindByIdentity(context, "User0");
var groups = userPrinciple.GetAuthorizationGroups();
if (userPrinciple != null)
{
foreach (GroupPrincipal gp in groups)
{
//some thing
}
}
Is there any permission that I need to give? In some of the blogs I learned that if there are no users which are set to include the SID history then this will work fine (but i think you can not edit the sid values of the groups)