Tell me more ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

If you want to return all users in an AD Group you can use this method :

SPPrincipalInfo[] principals = SPUtility.GetPrincipalsInGroup(SPContext.Current.Web, "TestGroup", 1000, out maxReached);

However, how can we reliably test to see if "TestGroup" exists ? If the group really doesn't exist then GetPrincipalsInGroup() returns null which is ok!

However, and here's the snag, that method ALSO returns null (no exception) if AD is down / unavailable, so gives a false result.

I don't want to have to hardcode a load of AD calls, as this could also be a forms-based group, or any other membership provider ...

Any ideas ???

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.