// Token: 0x0600206D RID: 8301 RVA: 0x00078A6C File Offset: 0x00076C6C
        internal static bool AddOtherMailboxConfig(CallContext callContext, string displayName, string primarySMTPAddress)
        {
            if (string.IsNullOrWhiteSpace(primarySMTPAddress))
            {
                return(false);
            }
            UserContext userContext = UserContextManager.GetUserContext(callContext.HttpContext, callContext.EffectiveCaller, true);

            if (userContext.IsExplicitLogon)
            {
                throw new OwaInvalidRequestException("Cannot open other's folder in explict logon mode");
            }
            SmtpAddress       smtpAddress        = SmtpAddress.Parse(primarySMTPAddress);
            IRecipientSession adrecipientSession = CallContext.Current.ADRecipientSessionContext.GetADRecipientSession();
            ADRecipient       adrecipient        = adrecipientSession.FindByProxyAddress(ProxyAddress.Parse(smtpAddress.ToString()));

            if (string.Equals(userContext.ExchangePrincipal.LegacyDn, adrecipient.LegacyExchangeDN, StringComparison.OrdinalIgnoreCase))
            {
                throw new OwaInvalidOperationException("Cannot open own folder");
            }
            SimpleConfiguration <OtherMailboxConfigEntry> otherMailboxConfig = OwaOtherMailboxConfiguration.GetOtherMailboxConfig(CallContext.Current);

            if (OwaOtherMailboxConfiguration.FindOtherMailboxConfigEntry(otherMailboxConfig, primarySMTPAddress) == null)
            {
                OtherMailboxConfigEntry otherMailboxConfigEntry = new OtherMailboxConfigEntry();
                otherMailboxConfigEntry.DisplayName          = displayName;
                otherMailboxConfigEntry.PrincipalSMTPAddress = primarySMTPAddress;
                otherMailboxConfig.Entries.Add(otherMailboxConfigEntry);
                otherMailboxConfig.Save(CallContext.Current);
            }
            return(true);
        }
        // Token: 0x0600206E RID: 8302 RVA: 0x00078B4C File Offset: 0x00076D4C
        internal static bool RemoveOtherMailboxConfig(CallContext callContext, string primarySMTPAddress)
        {
            if (string.IsNullOrWhiteSpace(primarySMTPAddress))
            {
                return(false);
            }
            SimpleConfiguration <OtherMailboxConfigEntry> otherMailboxConfig = OwaOtherMailboxConfiguration.GetOtherMailboxConfig(CallContext.Current);
            OtherMailboxConfigEntry otherMailboxConfigEntry = OwaOtherMailboxConfiguration.FindOtherMailboxConfigEntry(otherMailboxConfig, primarySMTPAddress);

            if (otherMailboxConfigEntry != null)
            {
                otherMailboxConfig.Entries.Remove(otherMailboxConfigEntry);
                otherMailboxConfig.Save(CallContext.Current);
            }
            return(true);
        }
        // Token: 0x06002071 RID: 8305 RVA: 0x00078BD8 File Offset: 0x00076DD8
        private static void ConvertLegacyItemIdFormatIfNecessary(SimpleConfiguration <OtherMailboxConfigEntry> otherMailboxConfig, CallContext callContext)
        {
            bool flag = false;

            for (int i = otherMailboxConfig.Entries.Count - 1; i >= 0; i--)
            {
                OtherMailboxConfigEntry otherMailboxConfigEntry = otherMailboxConfig.Entries[i];
                if (!string.IsNullOrEmpty(otherMailboxConfigEntry.InboxFolderOwaStoreObjectId))
                {
                    flag = true;
                    bool flag2 = false;
                    try
                    {
                        OwaStoreObjectId  owaStoreObjectId  = OwaStoreObjectId.CreateFromString(otherMailboxConfigEntry.InboxFolderOwaStoreObjectId);
                        ExchangePrincipal exchangePrincipal = (owaStoreObjectId.MailboxOwnerLegacyDN != null) ? ExchangePrincipal.FromLegacyDN(callContext.SessionCache.GetMailboxIdentityMailboxSession().GetADSessionSettings(), owaStoreObjectId.MailboxOwnerLegacyDN) : callContext.AccessingPrincipal;
                        otherMailboxConfigEntry.PrincipalSMTPAddress        = exchangePrincipal.MailboxInfo.PrimarySmtpAddress.ToString();
                        otherMailboxConfigEntry.InboxFolderOwaStoreObjectId = null;
                        flag2 = true;
                    }
                    catch (OwaInvalidIdFormatException)
                    {
                    }
                    catch (OwaInvalidRequestException)
                    {
                    }
                    catch (ObjectNotFoundException)
                    {
                    }
                    finally
                    {
                        if (!flag2)
                        {
                            otherMailboxConfig.Entries.RemoveAt(i);
                        }
                    }
                }
            }
            if (flag)
            {
                otherMailboxConfig.Save(callContext);
            }
        }