private static void GetQueryParameters(IRecipientSession session, out ADObjectId rootId, out QueryScope queryScope)
        {
            rootId     = null;
            queryScope = QueryScope.SubTree;
            OrganizationId currentOrganizationId = session.SessionSettings.CurrentOrganizationId;
            ConfigScopes   configScopes          = session.SessionSettings.ConfigScopes;

            if (currentOrganizationId == OrganizationId.ForestWideOrgId && OrganizationMailbox.IsScopeLimitedToFirstOrg(configScopes) && OrganizationMailbox.IsMultiTenantEnvironment())
            {
                ExTraceGlobals.StorageTracer.TraceDebug(0L, "Scoping search to First Org Users container in datacenter");
                rootId     = ADSystemConfigurationSession.GetFirstOrgUsersContainerId();
                queryScope = QueryScope.OneLevel;
                return;
            }
            ExTraceGlobals.StorageTracer.TraceDebug(0L, "Scoping search to rootId null");
        }
Exemple #2
0
        internal static ADUser ResolvePartitionMailbox(MailboxIdParameter partitionMailboxIdentity, IRecipientSession tenantGlobalCatalogSession, ADServerSettings serverSettings, DataAccessHelper.CategorizedGetDataObjectDelegate getDataObject, Task.ErrorLoggerDelegate writeError, bool datacenterFirstOrg)
        {
            ADUser aduser;

            if (partitionMailboxIdentity != null)
            {
                ADObjectId rootID = null;
                if (datacenterFirstOrg)
                {
                    rootID = ADSystemConfigurationSession.GetFirstOrgUsersContainerId();
                }
                aduser = (ADUser)getDataObject(partitionMailboxIdentity, tenantGlobalCatalogSession, rootID, null, new LocalizedString?(Strings.MigrationPartitionMailboxNotFound), new LocalizedString?(Strings.MigrationPartitionMailboxAmbiguous), ExchangeErrorCategory.Client);
                if (!aduser.PersistedCapabilities.Contains(Capability.OrganizationCapabilityMigration))
                {
                    writeError(new MigrationPartitionMailboxInvalidException(aduser.Alias), ExchangeErrorCategory.Client, partitionMailboxIdentity);
                }
            }
            else
            {
                List <ADUser> organizationMailboxesByCapability = OrganizationMailbox.GetOrganizationMailboxesByCapability(tenantGlobalCatalogSession, OrganizationCapability.Migration);
                if (organizationMailboxesByCapability == null || organizationMailboxesByCapability.Count == 0)
                {
                    organizationMailboxesByCapability = OrganizationMailbox.GetOrganizationMailboxesByCapability(tenantGlobalCatalogSession, OrganizationCapability.Management);
                }
                if (organizationMailboxesByCapability == null || organizationMailboxesByCapability.Count == 0)
                {
                    writeError(new MigrationPartitionMailboxNotFoundException(), ExchangeErrorCategory.Client, null);
                }
                else if (organizationMailboxesByCapability.Count > 1)
                {
                    writeError(new MigrationPartitionMailboxAmbiguousException(), ExchangeErrorCategory.Client, null);
                }
                aduser = organizationMailboxesByCapability[0];
            }
            if (aduser.RecipientTypeDetails != RecipientTypeDetails.ArbitrationMailbox || aduser.Database == null)
            {
                writeError(new MigrationPartitionMailboxInvalidException(aduser.Alias), ExchangeErrorCategory.Client, partitionMailboxIdentity);
            }
            return(aduser);
        }