示例#1
0
        internal static IRecipientSession GetTenantRecipientSessionByMSAUserNetID(LatencyTracker latencyTracker, string msaUserNetID, bool ignoreCannotResolveMSAUserNetIDException, bool requestForestWideDomainControllerAffinityByUserId)
        {
            if (latencyTracker == null)
            {
                throw new ArgumentNullException("latencyTracker");
            }
            NetID netID;

            if (!NetID.TryParse(msaUserNetID, out netID))
            {
                throw new ArgumentException("msaUserNetID");
            }
            ADSessionSettings sessionSettings = null;

            if (!Utilities.IsPartnerHostedOnly)
            {
                if (!VariantConfiguration.InvariantNoFlightingSnapshot.Global.WindowsLiveID.Enabled)
                {
                    goto IL_AE;
                }
            }
            try
            {
                sessionSettings = DirectoryHelper.CreateADTenantSessionSettingsByMSAUserNetID(latencyTracker, msaUserNetID);
                goto IL_B4;
            }
            catch (CannotResolveMSAUserNetIDException ex)
            {
                if (!ignoreCannotResolveMSAUserNetIDException)
                {
                    ExTraceGlobals.VerboseTracer.TraceWarning <string, CannotResolveMSAUserNetIDException>(0L, "[DirectoryHelper::GetTenantRecipientSessionByMSAUserNetID] Caught CannotResolveMSAUserNetIDException when trying to get tenant recipient session by MSA user NetID for {0}. Exception details: {1}.", msaUserNetID, ex);
                    throw new HttpProxyException(HttpStatusCode.NotFound, HttpProxySubErrorCode.UserNotFound, ex.Message, ex);
                }
                ExTraceGlobals.VerboseTracer.TraceWarning <string, CannotResolveMSAUserNetIDException>(0L, "[DirectoryHelper::GetTenantRecipientSessionByMSAUserNetID] Caught CannotResolveMSAUserNetIDException when trying to get tenant recipient session by MSA user NetID for {0}. Exception details: {1}.", msaUserNetID, ex);
                return(null);
            }
            catch (CannotResolveExternalDirectoryOrganizationIdException ex2)
            {
                throw new HttpProxyException(HttpStatusCode.NotFound, HttpProxySubErrorCode.DomainNotFound, ex2.Message, ex2);
            }
IL_AE:
            sessionSettings = ADSessionSettings.FromRootOrgScopeSet();
IL_B4:
            return(DirectoryHelper.CreateSession(sessionSettings, msaUserNetID, requestForestWideDomainControllerAffinityByUserId));
        }