private static QueryFilter CreateUsersLinkedToDatabaseFilter(ADObjectId databaseId) { QueryFilter queryFilter = new AndFilter(new QueryFilter[] { new ComparisonFilter(ComparisonOperator.Equal, ADMailboxRecipientSchema.Database, databaseId), new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.RecipientType, RecipientType.UserMailbox) }); QueryFilter queryFilter2 = new AndFilter(new QueryFilter[] { new ComparisonFilter(ComparisonOperator.Equal, ADUserSchema.ArchiveDatabaseRaw, databaseId), new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.RecipientType, RecipientType.UserMailbox) }); QueryFilter queryFilter3 = new AndFilter(new QueryFilter[] { new ComparisonFilter(ComparisonOperator.Equal, ADUserSchema.ArchiveDatabaseRaw, databaseId), new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.RecipientType, RecipientType.MailUser) }); QueryFilter queryFilter4 = new OrFilter(new QueryFilter[] { queryFilter, queryFilter2, queryFilter3 }); return(new AndFilter(new QueryFilter[] { queryFilter4, PartitionDataAggregator.CreateMonitoringMailboxFilter() })); }
public static IEnumerable <TenantRelocationRequest> FindPagedRelocationRequestsWithUnclassifiedPermanentError() { QueryFilter filter = new AndFilter(new QueryFilter[] { TenantRelocationRequest.TenantRelocationRequestFilter, new ComparisonFilter(ComparisonOperator.Equal, TenantRelocationRequestSchema.RelocationLastError, 255) }); return(PartitionDataAggregator.FindPaged <TenantRelocationRequest>(filter, false, null)); }
public static ADUser FindFirstMoveRequestLinkedToDatabase(ADObjectId databaseId) { QueryFilter filter = new AndFilter(new QueryFilter[] { new OrFilter(new QueryFilter[] { new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.RecipientType, RecipientType.UserMailbox), new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.RecipientType, RecipientType.MailUser) }), new ComparisonFilter(ComparisonOperator.Equal, ADUserSchema.MailboxMoveTargetMDB, databaseId) }); return(PartitionDataAggregator.FindFirstMatchingRecipientObject <ADUser>(filter, true, true, true, ConsistencyMode.PartiallyConsistent, true, true)); }
public static IEnumerable <ExchangeConfigurationUnit> FindForwardSyncMonitoringTenants() { QueryFilter filter = new TextFilter(ADObjectSchema.Name, "a830edad9050849EXPrv", MatchOptions.Prefix, MatchFlags.IgnoreCase); IEnumerable <Container> tenantContainers = PartitionDataAggregator.FindPaged <Container>(filter, false, null); foreach (Container tenantContainer in tenantContainers) { ExchangeConfigurationUnit cu = tenantContainer.Session.Read <ExchangeConfigurationUnit>(tenantContainer.Id.GetChildId("Configuration")); if (cu != null) { yield return(cu); } } yield break; }
public static MRSRequest FindFirstMRSRequestLinkedToDatabase(ADObjectId databaseId) { QueryFilter filter = new AndFilter(new QueryFilter[] { new ExistsFilter(MRSRequestSchema.MRSRequestType), new ComparisonFilter(ComparisonOperator.Equal, MRSRequestSchema.MailboxMoveStorageMDB, databaseId), new NotFilter(new OrFilter(new QueryFilter[] { new ComparisonFilter(ComparisonOperator.Equal, MRSRequestSchema.MailboxMoveStatus, RequestStatus.Completed), new ComparisonFilter(ComparisonOperator.Equal, MRSRequestSchema.MailboxMoveStatus, RequestStatus.CompletedWithWarning) })) }); return(PartitionDataAggregator.FindFirstMatchingConfigurationObject <MRSRequest>(filter, true, true, true, ConsistencyMode.PartiallyConsistent, true)); }
public static IEnumerable <TenantRelocationRequest> FindPagedRelocationRequests() { IEnumerable <TenantRelocationRequest> requestsInFlight = PartitionDataAggregator.FindPaged <TenantRelocationRequest>(TenantRelocationRequest.InFlightRelocationRequestsFilter, true, new SortBy(TenantRelocationRequestSchema.RelocationSyncStartTime, SortOrder.Ascending)); IEnumerable <TenantRelocationRequest> requestsJustStarted = PartitionDataAggregator.FindPaged <TenantRelocationRequest>(TenantRelocationRequest.JustStartedRelocationRequestsFilter, true, null); foreach (IEnumerable <TenantRelocationRequest> iterator in new IEnumerable <TenantRelocationRequest>[] { requestsInFlight, requestsJustStarted }) { foreach (TenantRelocationRequest request in iterator) { yield return(request); } } yield break; }
public static ADUser FindFirstUserOrMoveRequestLinkedToDatabase(ADObjectId databaseId) { QueryFilter queryFilter = new AndFilter(new QueryFilter[] { new ComparisonFilter(ComparisonOperator.Equal, ADUserSchema.MailboxMoveTargetMDB, databaseId), new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.RecipientType, RecipientType.UserMailbox) }); QueryFilter queryFilter2 = new AndFilter(new QueryFilter[] { new ComparisonFilter(ComparisonOperator.Equal, ADUserSchema.MailboxMoveTargetMDB, databaseId), new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.RecipientType, RecipientType.MailUser) }); QueryFilter queryFilter3 = new AndFilter(new QueryFilter[] { new ComparisonFilter(ComparisonOperator.Equal, ADMailboxRecipientSchema.Database, databaseId), new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.RecipientType, RecipientType.UserMailbox) }); QueryFilter queryFilter4 = new AndFilter(new QueryFilter[] { new ComparisonFilter(ComparisonOperator.Equal, ADUserSchema.ArchiveDatabaseRaw, databaseId), new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.RecipientType, RecipientType.UserMailbox) }); QueryFilter queryFilter5 = new AndFilter(new QueryFilter[] { new ComparisonFilter(ComparisonOperator.Equal, ADUserSchema.ArchiveDatabaseRaw, databaseId), new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.RecipientType, RecipientType.MailUser) }); QueryFilter queryFilter6 = new OrFilter(new QueryFilter[] { queryFilter3, queryFilter4, queryFilter5, queryFilter, queryFilter2 }); queryFilter6 = new AndFilter(new QueryFilter[] { queryFilter6, PartitionDataAggregator.CreateMonitoringMailboxFilter() }); return(PartitionDataAggregator.FindFirstMatchingRecipientObject <ADUser>(queryFilter6, true, true, true, ConsistencyMode.PartiallyConsistent, true, true)); }
private static T FindFirstMatchingObject <T>(QueryFilter filter, bool includeAccountForestRootOrg, bool includeResourceForest, bool useGC, ConsistencyMode consistencyMode, bool useRecipientSession, bool includeSoftDeletedObject, bool includeSecondaryPartitions) where T : ADObject, new() { IEnumerable <ADSessionSettings> enumerable = PartitionDataAggregator.CreateSessionSettingsCollection(includeAccountForestRootOrg, includeResourceForest, includeSecondaryPartitions); foreach (ADSessionSettings adsessionSettings in enumerable) { if (includeSoftDeletedObject) { adsessionSettings.IncludeSoftDeletedObjects = true; } IDirectorySession directorySession = PartitionDataAggregator.GetDirectorySession(consistencyMode, useRecipientSession, adsessionSettings); directorySession.UseGlobalCatalog = useGC; T[] array = directorySession.Find <T>(null, QueryScope.SubTree, filter, null, 1); if (array != null && array.Length != 0) { return(array[0]); } } return(default(T)); }
private static IEnumerable <T> FindPagedAllMatchingObjects <T>(QueryFilter filter, bool includeAccountForestRootOrg, bool includeResourceForest, bool useGC, ConsistencyMode consistencyMode, bool useRecipientSession, bool includeSoftDeletedObject, bool includeSecondaryPartitions) where T : ADObject, new() { IEnumerable <ADSessionSettings> sessionSettingsCollection = PartitionDataAggregator.CreateSessionSettingsCollection(includeAccountForestRootOrg, includeResourceForest, includeSecondaryPartitions); foreach (ADSessionSettings sessionSettings in sessionSettingsCollection) { if (includeSoftDeletedObject) { sessionSettings.IncludeSoftDeletedObjects = true; } IDirectorySession session = PartitionDataAggregator.GetDirectorySession(consistencyMode, useRecipientSession, sessionSettings); session.UseGlobalCatalog = useGC; ADPagedReader <T> reader = session.FindPaged <T>(null, QueryScope.SubTree, filter, null, 0, null); foreach (T result in reader) { yield return(result); } } yield break; }
public static IEnumerable <TResult> FindAllUsersLinkedToDatabase <TResult>(ADObjectId databaseId) where TResult : ADObject, new() { QueryFilter filter = PartitionDataAggregator.CreateUsersLinkedToDatabaseFilter(databaseId); return(PartitionDataAggregator.FindPagedAllMatchingObjects <TResult>(filter, true, true, true, ConsistencyMode.PartiallyConsistent, true, true, true)); }
public static ADUser FindFirstUserLinkedToDatabase(ADObjectId databaseId) { QueryFilter filter = PartitionDataAggregator.CreateUsersLinkedToDatabaseFilter(databaseId); return(PartitionDataAggregator.FindFirstMatchingRecipientObject <ADUser>(filter, true, true, true, ConsistencyMode.PartiallyConsistent, true, true)); }
private static T FindFirstMatchingConfigurationObject <T>(QueryFilter filter, bool includeAccountForestRootOrg, bool includeResourceForest, bool useGC, ConsistencyMode consistencyMode, bool includeSecondaryPartitions) where T : ADObject, new() { return(PartitionDataAggregator.FindFirstMatchingObject <T>(filter, includeAccountForestRootOrg, includeResourceForest, useGC, consistencyMode, false, false, includeSecondaryPartitions)); }
public static IEnumerable <TenantRelocationRequest> FindPagedStaleLockedRelocationRequests(ExDateTime olderThan) { QueryFilter staleLockedRelocationRequestsFilter = TenantRelocationRequest.GetStaleLockedRelocationRequestsFilter(olderThan, true); return(PartitionDataAggregator.FindPaged <TenantRelocationRequest>(staleLockedRelocationRequestsFilter, false, null)); }
public static IEnumerable <MsoTenantCookieContainer> FindTenantCookieContainers(QueryFilter filter) { return(PartitionDataAggregator.FindPaged <MsoTenantCookieContainer>(filter, false, null)); }
public static MiniRecipient GetMiniRecipientFromUserId(SecurityIdentifier sid) { return(PartitionDataAggregator.GetMiniRecipientFromUserId(sid, null, ConsistencyMode.PartiallyConsistent)); }