コード例 #1
0
        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);
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
ファイル: ADObjectSearcher.cs プロジェクト: nickchal/pash
		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;
		}
コード例 #4
0
ファイル: ADObjectSearcher.cs プロジェクト: nickchal/pash
		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;
			}
		}