Beispiel #1
0
        public static DirectorySearcherImpl Constructor(IValue searchRoot = null, string filter = "(objectClass=*)", IValue propertiesToLoad = null, SearchScopeImpl searchScope = SearchScopeImpl.Subtree)
        {
            DirectoryEntryImpl dirEntry    = null;
            ArrayImpl          propsToLoad = new ArrayImpl();

            if (searchRoot?.GetRawValue() is DirectoryEntryImpl val_de)
            {
                dirEntry = val_de;
            }
            else if (searchRoot != null)
            {
                throw RuntimeException.InvalidArgumentType();
            }

            if (propertiesToLoad?.GetRawValue() is ArrayImpl val_ptl)
            {
                propsToLoad = val_ptl;
            }
            else if (propertiesToLoad != null)
            {
                throw RuntimeException.InvalidArgumentType();
            }

            var dirseacrh = new DirectorySearcherImpl(dirEntry, filter, propsToLoad, searchScope);

            return(dirseacrh);
        }
Beispiel #2
0
 public DirectorySearcherImpl(DirectoryEntryImpl directoryEntry, string filter, ArrayImpl propsToLoad, SearchScopeImpl searchScope)
 {
     _directorySearcher = new DirectorySearcher(directoryEntry._directoryEntry, filter, propsToLoad.Select(p => p.AsString()).ToArray(), SearchScopeConverter.ToSearchScope(searchScope));
     SearchRoot         = directoryEntry;
     PropertiesToLoad   = propsToLoad;
     SearchScope        = searchScope;
 }