How can I about getting a user's group memberships from AD, preferably using the same pattern as I use to get the user's Department property, as below? I have found several examples, but the intersecting set of all example techniques is quite small, and lacks the tightness and simplicity of this Department query:
var adServer = ConfigurationManager.AppSettings["adServer"] ?? "localhost";
var remoteRoot = new DirectoryEntry(GetRootPath(adServer));
var searcher = new DirectorySearcher(remoteRoot, string.Format("(SAMAccountName={0})", shortUserName));
searcher.PropertiesToLoad.Add("Department");
SearchResult result = null;
result = searcher.FindOne();