コード例 #1
0
        // Token: 0x06000779 RID: 1913 RVA: 0x0001D180 File Offset: 0x0001B380
        public IAsyncResult BeginGetBackEndServerList(MiniRecipient miniRecipient, int maxServers, AsyncCallback callback, object state)
        {
            if (miniRecipient == null)
            {
                throw new ArgumentNullException("miniRecipient");
            }
            if (maxServers <= 0)
            {
                throw new ArgumentException("maxServers needs to be greater than zero");
            }
            this.database   = miniRecipient.Database;
            this.maxServers = maxServers;
            OrganizationId organizationId     = miniRecipient.OrganizationId;
            SmtpAddress    primarySmtpAddress = miniRecipient.PrimarySmtpAddress;

            if (this.database == null)
            {
                ADUser defaultOrganizationMailbox = HttpProxyBackEndHelper.GetDefaultOrganizationMailbox(organizationId, null);
                if (defaultOrganizationMailbox == null || defaultOrganizationMailbox.Database == null)
                {
                    ExTraceGlobals.CafeTracer.TraceError <OrganizationId>(0L, "[BackEndLocator.BeginGetBackEndServerList] Cannot find organization mailbox for organization {1}", organizationId);
                    throw new AdUserNotFoundException(ServerStrings.ADUserNotFound);
                }
                this.database      = defaultOrganizationMailbox.Database;
                primarySmtpAddress = defaultOrganizationMailbox.PrimarySmtpAddress;
            }
            string domainName = null;

            if (organizationId != null && !organizationId.Equals(OrganizationId.ForestWideOrgId))
            {
                domainName = primarySmtpAddress.Domain;
            }
            this.serverLocator = MailboxServerLocator.Create(this.database.ObjectGuid, domainName, this.database.PartitionFQDN);
            bool         flag = true;
            IAsyncResult result;

            try
            {
                result = this.serverLocator.BeginGetServer(callback, state);
                flag   = false;
            }
            catch (Exception ex)
            {
                ExTraceGlobals.CafeTracer.TraceError <Exception>(0L, "[AsyncBackEndLocator.BeginGetBackEndServerList] Caught exception {0}.", ex);
                if (BackEndLocator.ShouldWrapInBackendLocatorException(ex))
                {
                    throw new BackEndLocatorException(ex);
                }
                throw;
            }
            finally
            {
                if (flag)
                {
                    this.serverLocator.Dispose();
                    this.serverLocator = null;
                }
            }
            return(result);
        }
コード例 #2
0
        internal static ADUser GetDefaultOrganizationMailbox(OrganizationId organizationId, string anchorMailboxKey = null)
        {
            if (organizationId == null)
            {
                organizationId = OrganizationId.ForestWideOrgId;
            }
            IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(true, ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(organizationId), 126, "GetDefaultOrganizationMailbox", "f:\\15.00.1497\\sources\\dev\\data\\src\\ApplicationLogic\\Cafe\\HttpProxyBackEndHelper.cs");

            return(HttpProxyBackEndHelper.GetDefaultOrganizationMailbox(tenantOrRootOrgRecipientSession, anchorMailboxKey));
        }
コード例 #3
0
        private static BackEndServer GetBackEndServerByOrganization(OrganizationId organizationId)
        {
            ADUser defaultOrganizationMailbox = HttpProxyBackEndHelper.GetDefaultOrganizationMailbox(organizationId, null);

            if (defaultOrganizationMailbox == null || defaultOrganizationMailbox.Database == null)
            {
                ExTraceGlobals.CafeTracer.TraceError <OrganizationId>(0L, "[BackEndLocator.GetBackEndServerByOrganization] Cannot find organization mailbox for organization {1}", organizationId);
                throw new AdUserNotFoundException(ServerStrings.ADUserNotFound);
            }
            return(BackEndLocator.GetBackEndServerByDatabase(defaultOrganizationMailbox.Database, organizationId, defaultOrganizationMailbox.PrimarySmtpAddress));
        }