Ejemplo n.º 1
0
        // Token: 0x06002292 RID: 8850 RVA: 0x0007F0D0 File Offset: 0x0007D2D0
        private bool ConvertLegacyItemIdFormatIfNecessary(SimpleConfiguration <TargetFolderMRUEntry> folderMruConfig, CallContext callContext)
        {
            bool result = false;

            foreach (TargetFolderMRUEntry targetFolderMRUEntry in folderMruConfig.Entries)
            {
                if (targetFolderMRUEntry.EwsFolderIdEntry == null)
                {
                    try
                    {
                        OwaStoreObjectId  owaStoreObjectId  = OwaStoreObjectId.CreateFromString(targetFolderMRUEntry.FolderId);
                        ExchangePrincipal exchangePrincipal = (owaStoreObjectId.MailboxOwnerLegacyDN != null) ? ExchangePrincipal.FromLegacyDN(callContext.SessionCache.GetMailboxIdentityMailboxSession().GetADSessionSettings(), owaStoreObjectId.MailboxOwnerLegacyDN) : callContext.AccessingPrincipal;
                        new IdConverter(callContext);
                        FolderId folderIdFromStoreId = IdConverter.GetFolderIdFromStoreId(owaStoreObjectId.StoreId, new MailboxId(exchangePrincipal.MailboxInfo.MailboxGuid));
                        targetFolderMRUEntry.EwsFolderIdEntry = folderIdFromStoreId.Id;
                        result = true;
                    }
                    catch (OwaInvalidIdFormatException)
                    {
                    }
                    catch (OwaInvalidRequestException)
                    {
                    }
                    catch (ObjectNotFoundException)
                    {
                    }
                }
            }
            return(result);
        }
        // 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);
            }
        }