public static OwaStoreObjectId CreateFromNavigationNodeFolder(UserContext userContext, NavigationNodeFolder nodeFolder)
        {
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            if (nodeFolder == null)
            {
                throw new ArgumentNullException("nodeFolder");
            }
            if (!nodeFolder.IsValid)
            {
                throw new ArgumentException("Not valid navigation node folder.");
            }
            if (!nodeFolder.IsGSCalendar && nodeFolder.FolderId == null)
            {
                throw new NotSupportedException("Doesn't support this kind of node folder");
            }
            if (nodeFolder.IsFolderInSpecificMailboxSession(userContext.MailboxSession))
            {
                return(OwaStoreObjectId.CreateFromMailboxFolderId(nodeFolder.FolderId));
            }
            if (nodeFolder.IsGSCalendar)
            {
                return(OwaStoreObjectId.CreateFromGSCalendarLegacyDN(nodeFolder.MailboxLegacyDN));
            }
            ExchangePrincipal exchangePrincipal;

            if (userContext.DelegateSessionManager.TryGetExchangePrincipal(nodeFolder.MailboxLegacyDN, out exchangePrincipal) && exchangePrincipal.MailboxInfo.IsArchive)
            {
                return(OwaStoreObjectId.CreateFromArchiveMailboxFolderId(nodeFolder.FolderId, nodeFolder.MailboxLegacyDN));
            }
            return(OwaStoreObjectId.CreateFromOtherUserMailboxFolderId(nodeFolder.FolderId, nodeFolder.MailboxLegacyDN));
        }
        public static OwaStoreObjectId CreateFromSessionFolderId(OwaStoreObjectIdType owaStoreObjectIdType, string legacyDN, StoreObjectId folderId)
        {
            if (folderId == null)
            {
                throw new ArgumentNullException("folderId");
            }
            switch (owaStoreObjectIdType)
            {
            case OwaStoreObjectIdType.MailBoxObject:
                return(OwaStoreObjectId.CreateFromMailboxFolderId(folderId));

            case OwaStoreObjectIdType.PublicStoreFolder:
                return(OwaStoreObjectId.CreateFromPublicFolderId(folderId));

            case OwaStoreObjectIdType.OtherUserMailboxObject:
                return(OwaStoreObjectId.CreateFromOtherUserMailboxFolderId(folderId, legacyDN));

            case OwaStoreObjectIdType.ArchiveMailboxObject:
                return(OwaStoreObjectId.CreateFromArchiveMailboxFolderId(folderId, legacyDN));
            }
            throw new ArgumentException("mailbox session type is unknown");
        }
Exemple #3
0
        // Token: 0x06000D0B RID: 3339 RVA: 0x00058630 File Offset: 0x00056830
        internal static OtherMailboxConfigEntry AddOtherMailboxSession(UserContext userContext, MailboxSession mailboxSession)
        {
            SimpleConfiguration <OtherMailboxConfigEntry> otherMailboxConfig = OtherMailboxConfiguration.GetOtherMailboxConfig(userContext);

            if (OtherMailboxConfiguration.FindOtherMailboxConfigEntry(otherMailboxConfig, mailboxSession.MailboxOwnerLegacyDN) != null)
            {
                return(null);
            }
            StoreObjectId           defaultFolderId         = Utilities.GetDefaultFolderId(mailboxSession, DefaultFolderType.Root);
            OtherMailboxConfigEntry otherMailboxConfigEntry = new OtherMailboxConfigEntry(Utilities.GetMailboxOwnerDisplayName(mailboxSession), OwaStoreObjectId.CreateFromOtherUserMailboxFolderId(defaultFolderId, mailboxSession.MailboxOwner.LegacyDn));

            otherMailboxConfig.Entries.Add(otherMailboxConfigEntry);
            otherMailboxConfig.Save();
            return(otherMailboxConfigEntry);
        }