public virtual IEnumerable <IDirectoryObject> FindAll( [NotNull] AdsPath searchRootAdsPath, [NotNull] SearchFilter searchFilter, [NotNull] DirectoryProperty asqProperty) { Guard.CheckNull(searchRootAdsPath, nameof(searchRootAdsPath)); Guard.CheckNull(searchFilter, nameof(searchFilter)); Guard.CheckNull(asqProperty, nameof(asqProperty)); if (asqProperty.Syntax != DirectoryPropertySyntax.DNString) { throw new DirectoryServicesException(ErrorMessages.DirectoryServicesException_InvalidAsqPropertySyntax); } logger.Debug( "Search multiple objects in {SearchRoot} by {AsqProperty} with filter {SearchFilter}.", searchRootAdsPath, asqProperty, searchFilter); using (var root = new DirectoryEntry(searchRootAdsPath)) { var searcher = CreateDirectorySearcher(searchFilter, root); searcher.SearchScope = SearchScope.Base; searcher.AttributeScopeQuery = asqProperty; searcher.ReferralChasing = ReferralChasingOption.All; searcher.PropertyNamesOnly = true; var results = FindAllInternal(searcher); return(results); } }
public virtual T FindOne <T>( [NotNull] AdsPath searchRoot, [NotNull] DirectoryProperty directoryProperty, object propertyValue) where T : class, IDirectoryObject { return(FindOne(searchRoot, directoryProperty, propertyValue) as T); }
public virtual IDirectoryObject FindOne( [NotNull] AdsPath searchRoot, [NotNull] DirectoryProperty directoryProperty, object propertyValue) { Guard.CheckNull(directoryProperty, nameof(directoryProperty)); var searchFilter = SearchFilter.Equality( directoryProperty, directoryProperty.CreateSearchFilterString(propertyValue)); return(FindOne(searchRoot, searchFilter)); }
public DirectoryObjectCollection( [NotNull] IDirectoryObject directoryObject, DirectoryProperty dnCollectionProperty) : base(Guard.CheckNull(directoryObject, nameof(directoryObject))) { DNCollectionProperty = Guard.CheckNull(dnCollectionProperty, nameof(dnCollectionProperty)); }