public ADRootDSE GetRootDSE(ICollection <string> propertyList, bool propertyNamesOnly) { this.Init(); ADRootDSE aDRootDSE = null; string[] strArrays = null; if (propertyList != null) { strArrays = new string[propertyList.Count]; propertyList.CopyTo(strArrays, 0); } ADSearchRequest aDSearchRequest = new ADSearchRequest("", ADObjectSearcher.DefaultSearchFilter.GetLdapFilterString(), SearchScope.Base, strArrays); aDSearchRequest.TypesOnly = propertyNamesOnly; aDSearchRequest.TimeLimit = this._timeLimit; ADSearchResponse aDSearchResponse = this._syncOps.Search(this._sessionHandle, aDSearchRequest); if (aDSearchResponse.Entries.Count > 0) { aDRootDSE = new ADRootDSE(); ADObject item = aDSearchResponse.Entries[0]; foreach (string propertyName in item.PropertyNames) { aDRootDSE.Add(propertyName, item[propertyName]); } } return(aDRootDSE); }
public ADRootDSE GetRootDSE() { this.Init(); ADRootDSE rootDSE = this._adSession.RootDSE; if (rootDSE == null) { string[] strArrays = new string[2]; strArrays[0] = "*"; strArrays[1] = "msDS-PortLDAP"; ADSearchRequest aDSearchRequest = new ADSearchRequest("", ADObjectSearcher.DefaultSearchFilter.GetLdapFilterString(), SearchScope.Base, strArrays); aDSearchRequest.TimeLimit = this._timeLimit; ADSearchResponse aDSearchResponse = this._syncOps.Search(this._sessionHandle, aDSearchRequest); if (aDSearchResponse.Entries.Count > 0) { rootDSE = new ADRootDSE(); ADObject item = aDSearchResponse.Entries[0]; foreach (string propertyName in item.PropertyNames) { rootDSE.Add(propertyName, item[propertyName]); } this._adSession.RootDSE = rootDSE; } return(rootDSE); } else { return(rootDSE); } }
public ADRootDSE GetRootDSE(ICollection<string> propertyList, bool propertyNamesOnly) { this.Init(); ADRootDSE aDRootDSE = null; string[] strArrays = null; if (propertyList != null) { strArrays = new string[propertyList.Count]; propertyList.CopyTo(strArrays, 0); } ADSearchRequest aDSearchRequest = new ADSearchRequest("", ADObjectSearcher.DefaultSearchFilter.GetLdapFilterString(), SearchScope.Base, strArrays); aDSearchRequest.TypesOnly = propertyNamesOnly; aDSearchRequest.TimeLimit = this._timeLimit; ADSearchResponse aDSearchResponse = this._syncOps.Search(this._sessionHandle, aDSearchRequest); if (aDSearchResponse.Entries.Count > 0) { aDRootDSE = new ADRootDSE(); ADObject item = aDSearchResponse.Entries[0]; foreach (string propertyName in item.PropertyNames) { aDRootDSE.Add(propertyName, item[propertyName]); } } return aDRootDSE; }
public ADRootDSE GetRootDSE() { this.Init(); ADRootDSE rootDSE = this._adSession.RootDSE; if (rootDSE == null) { string[] strArrays = new string[2]; strArrays[0] = "*"; strArrays[1] = "msDS-PortLDAP"; ADSearchRequest aDSearchRequest = new ADSearchRequest("", ADObjectSearcher.DefaultSearchFilter.GetLdapFilterString(), SearchScope.Base, strArrays); aDSearchRequest.TimeLimit = this._timeLimit; ADSearchResponse aDSearchResponse = this._syncOps.Search(this._sessionHandle, aDSearchRequest); if (aDSearchResponse.Entries.Count > 0) { rootDSE = new ADRootDSE(); ADObject item = aDSearchResponse.Entries[0]; foreach (string propertyName in item.PropertyNames) { rootDSE.Add(propertyName, item[propertyName]); } this._adSession.RootDSE = rootDSE; } return rootDSE; } else { return rootDSE; } }