/// <summary> /// Obtain user from Windows Active Directory using simple Username format /// </summary> /// <remarks> /// Reserved for simple network which have single domain and logon username in simple format /// </remarks> /// <history> /// [tamttt] 08/01/2004 Created /// </history> public static DirectoryEntry GetUser0(string Name) { // Create search object then assign required params to get user entry in Active Directory Search objSearch = new Search(GetRootDomain()); DirectoryEntry userEntry; objSearch.AddFilter(Configuration.ADSI_CLASS, CompareOperator.Is, ObjectClass.person.ToString()); objSearch.AddFilter(Configuration.ADSI_ACCOUNTNAME, CompareOperator.Is, Name); userEntry = objSearch.GetEntry(); return(userEntry); }
/// <summary> /// Obtain user from Windows Active Directory using UPN format - USERNAME@DOMAIN /// </summary> /// <remarks> /// </remarks> /// <history> /// [tamttt] 08/01/2004 Created /// </history> public static DirectoryEntry GetUserByUPN0(string Name, Domain RootDomain) { // Create search object then assign required params to get user entry in Active Directory Search objSearch = new Search(RootDomain); DirectoryEntry userEntry; // UPN is unique in entire Windows network objSearch.AddFilter(Configuration.ADSI_CLASS, CompareOperator.Is, ObjectClass.person.ToString()); objSearch.AddFilter(Configuration.ADSI_UPN, CompareOperator.Is, Name); userEntry = objSearch.GetEntry(); return(userEntry); }
public static DirectoryEntry GetGroupEntryByName(string GroupName) { Domain RootDomain = GetRootDomain(); Search objSearch = new Search(RootDomain); objSearch.AddFilter(Configuration.ADSI_CLASS, CompareOperator.Is, ObjectClass.group.ToString()); objSearch.AddFilter(Configuration.ADSI_ACCOUNTNAME, CompareOperator.Is, GroupName); DirectoryEntry groupEntry = objSearch.GetEntry(); if (groupEntry != null) { return(groupEntry); } else { return(null); } }
/// <summary> /// Obtain user from Windows Active Directory using UPN format - USERNAME@DOMAIN /// </summary> /// <remarks> /// </remarks> /// <history> /// [tamttt] 08/01/2004 Created /// </history> public static DirectoryEntry GetUserByUPN0( string Name, Domain RootDomain ) { // Create search object then assign required params to get user entry in Active Directory Search objSearch = new Search( RootDomain ); DirectoryEntry userEntry; // UPN is unique in entire Windows network objSearch.AddFilter( Configuration.ADSI_CLASS, CompareOperator.Is, ObjectClass.person.ToString() ); objSearch.AddFilter( Configuration.ADSI_UPN, CompareOperator.Is, Name ); userEntry = objSearch.GetEntry(); return userEntry; }
/// <summary> /// Obtain user from Windows Active Directory using simple Username format /// </summary> /// <remarks> /// Reserved for simple network which have single domain and logon username in simple format /// </remarks> /// <history> /// [tamttt] 08/01/2004 Created /// </history> public static DirectoryEntry GetUser0( string Name ) { // Create search object then assign required params to get user entry in Active Directory Search objSearch = new Search( GetRootDomain() ); DirectoryEntry userEntry; objSearch.AddFilter( Configuration.ADSI_CLASS, CompareOperator.Is, ObjectClass.person.ToString() ); objSearch.AddFilter( Configuration.ADSI_ACCOUNTNAME, CompareOperator.Is, Name ); userEntry = objSearch.GetEntry(); return userEntry; }
public static DirectoryEntry GetGroupEntryByName( string GroupName ) { Domain RootDomain = GetRootDomain(); Search objSearch = new Search( RootDomain ); objSearch.AddFilter( Configuration.ADSI_CLASS, CompareOperator.Is, ObjectClass.group.ToString() ); objSearch.AddFilter( Configuration.ADSI_ACCOUNTNAME, CompareOperator.Is, GroupName ); DirectoryEntry groupEntry = objSearch.GetEntry(); if( groupEntry != null ) { return groupEntry; } else { return null; } }