コード例 #1
0
        // Token: 0x06000A62 RID: 2658 RVA: 0x0004446C File Offset: 0x0004266C
        internal static bool TryLoadRegionalConfiguration(MailboxSession session, out MailboxRegionalConfiguration regionalConfiguration)
        {
            regionalConfiguration = null;
            ADUser aduser = Utils.GetADRecipient(UserSettings.GetExternalDirectoryOrganizationId(session), session.MailboxOwnerLegacyDN) as ADUser;

            if (aduser == null)
            {
                Utils.Tracer.TraceError <string>((long)typeof(MailboxData).GetHashCode(), "Can't find AD recipient by mailbox owner's DN {0}", session.MailboxOwnerLegacyDN);
                return(false);
            }
            MailboxStoreTypeProvider mailboxStoreTypeProvider = new MailboxStoreTypeProvider(aduser);

            mailboxStoreTypeProvider.MailboxSession = session;
            try
            {
                regionalConfiguration = (MailboxRegionalConfiguration)mailboxStoreTypeProvider.Read <MailboxRegionalConfiguration>(session.MailboxOwner.ObjectId);
            }
            catch (FormatException arg)
            {
                Utils.Tracer.TraceError <ADObjectId, FormatException>((long)typeof(MailboxData).GetHashCode(), "MailboxRegionalConfiguration cannot be retrieved for user {0}. Error: {1}", session.MailboxOwner.ObjectId, arg);
                return(false);
            }
            if (regionalConfiguration == null || null == regionalConfiguration.TimeZone || regionalConfiguration.TimeZone.ExTimeZone == null)
            {
                Utils.Tracer.TraceError <ADObjectId>((long)typeof(MailboxData).GetHashCode(), "User {0} doesn't set a valid RegionalConfiguration or TimeZone", session.MailboxOwner.ObjectId);
                return(false);
            }
            return(true);
        }
コード例 #2
0
        // Token: 0x06001664 RID: 5732 RVA: 0x0007E0B0 File Offset: 0x0007C2B0
        internal static ExTimeZone LoadRegionalConfiguration(ADUser adUser, MailboxSession session)
        {
            ExTraceGlobals.HeuristicsTracer.TraceFunction(0L, "ReminderTimeCalculatorContext.LoadRegionalConfiguration");
            MailboxStoreTypeProvider mailboxStoreTypeProvider = new MailboxStoreTypeProvider(adUser);

            mailboxStoreTypeProvider.MailboxSession = session;
            MailboxRegionalConfiguration mailboxRegionalConfiguration = null;

            try
            {
                mailboxRegionalConfiguration = (MailboxRegionalConfiguration)mailboxStoreTypeProvider.Read <MailboxRegionalConfiguration>(session.MailboxOwner.ObjectId);
            }
            catch (FormatException arg)
            {
                ExTraceGlobals.GeneralTracer.TraceError <IExchangePrincipal, FormatException>(0L, "User '{0}' doesn't have a valid regional configuration - {1}", session.MailboxOwner, arg);
            }
            if (mailboxRegionalConfiguration != null && mailboxRegionalConfiguration.TimeZone != null)
            {
                ExTraceGlobals.HeuristicsTracer.TraceDebug <string, IExchangePrincipal>(0L, "Found time zone {0} for User '{0}'", mailboxRegionalConfiguration.TimeZone.ExTimeZone.ToString(), session.MailboxOwner);
                return(mailboxRegionalConfiguration.TimeZone.ExTimeZone);
            }
            ExTraceGlobals.HeuristicsTracer.TraceDebug <IExchangePrincipal>(0L, "User '{0}' doesn't have a valid regional configuration - using UTC as default time zone", session.MailboxOwner);
            return(ExTimeZone.UtcTimeZone);
        }