public static void RemoveFromGroup(string userName, DirectoryEntry groupToRemoveFrom) { ADUtil adu = new ADUtil(); DirectoryEntry user = adu.GetUserDirectoryEntry(userName); RemoveFromGroup(user, groupToRemoveFrom); }
public static void AddToGroup(string userName, DirectoryEntry groupEntry) { ADUtil adu = new ADUtil(); DirectoryEntry user = adu.GetUserDirectoryEntry(userName); AddToGroup(user, groupEntry); }
public ADUser(string userId, DirectoryEntry searchRoot) { this.userId = userId; ADUtil ad = new ADUtil(); this.userEntry = ad.GetUserDirectoryEntry(userId, new string[] { "givenName", "sn", "maxPwdAge", "pwdLastSet" }, searchRoot); this.firstName = EntryUtil.GetProperty(userEntry, "givenName"); this.lastName = EntryUtil.GetProperty(userEntry, "sn"); this.mailBoxLocation = EntryUtil.GetProperty(userEntry, "HomeMDB"); this.hasExchangeMailBox = !string.IsNullOrEmpty(this.mailBoxLocation); this.emailAddress = EntryUtil.GetProperty(userEntry, "mail"); }
/// <summary> /// Returns true if the specified user is found in the default Active Directory for the /// current process. /// </summary> /// <param name="userId">The userId to find.</param> /// <returns>True if the user is found false otherwise.</returns> public static bool Exists(string userId) { ADUtil ad = new ADUtil(); return ad.GetUserDirectoryEntry(userId) != null; }
/// <summary> /// Returns true if the specified user is found in the default Active Directory for the /// current process. /// </summary> /// <param name="userId">The userId to find.</param> /// <returns>True if the user is found false otherwise.</returns> public static bool Exists(string userId) { ADUtil ad = new ADUtil(); return(ad.GetUserDirectoryEntry(userId) != null); }
public static string[] GetUsersGroups(string userName, bool forceRecache) { ADUtil ad = new ADUtil(); return GetUsersGroups(ad.GetUserDirectoryEntry(userName, null), forceRecache); }
public static string[] GetUsersGroups(string userName, bool forceRecache) { ADUtil ad = new ADUtil(); return(GetUsersGroups(ad.GetUserDirectoryEntry(userName, null), forceRecache)); }
public static DirectoryEntry GetOU(string ouPathWithoutDefaultNamingContext, string defaultNamingContext) { return(ADUtil.GetOU(ouPathWithoutDefaultNamingContext, defaultNamingContext)); }
public static void DeleteGroup(string groupName, string ouPathWithoutDefaultNamingContext) { DirectoryEntry OU = ADUtil.GetOU(ouPathWithoutDefaultNamingContext); DeleteGroup(groupName, OU); }