Beispiel #1
0
        private CalendarFolder OpenFolder(bool throwIfFolderNotFound)
        {
            CalendarFolder calendarFolder = null;

            this.isFromOlderVersion = false;
            if (this.exchangePrincipal == null && (this.FolderId.IsOtherMailbox || this.FolderId.IsGSCalendar) && !this.UserContext.DelegateSessionManager.TryGetExchangePrincipal(this.FolderId.MailboxOwnerLegacyDN, out this.exchangePrincipal))
            {
                throw new OwaLoadSharedCalendarFailedException("cannot get exchange principal");
            }
            try
            {
                if (this.IsGSCalendar)
                {
                    StoreObjectId storeObjectId = Utilities.TryGetDefaultFolderId(this.UserContext, this.exchangePrincipal, DefaultFolderType.Calendar);
                    if (storeObjectId != null)
                    {
                        this.PromotedFolderId = OwaStoreObjectId.CreateFromOtherUserMailboxFolderId(storeObjectId, this.LegacyDN);
                    }
                }
                else
                {
                    this.PromotedFolderId = this.FolderId;
                }
                if (this.PromotedFolderId != null)
                {
                    try
                    {
                        calendarFolder = Utilities.GetFolderForContent <CalendarFolder>(this.UserContext, this.PromotedFolderId, CalendarUtilities.FolderViewProperties);
                        if (!this.IsGSCalendar)
                        {
                            this.FolderId = OwaStoreObjectId.CreateFromSessionFolderId(this.FolderId.OwaStoreObjectIdType, this.FolderId.MailboxOwnerLegacyDN, calendarFolder.StoreObjectId);
                        }
                    }
                    catch (ObjectNotFoundException)
                    {
                        if (throwIfFolderNotFound)
                        {
                            throw;
                        }
                    }
                    catch (WrongObjectTypeException innerException)
                    {
                        throw new OwaInvalidRequestException("The folder is not a calendar folder", innerException, this);
                    }
                }
            }
            catch (OwaSharedFromOlderVersionException)
            {
                this.isFromOlderVersion = true;
                throw;
            }
            return(calendarFolder);
        }
        // Token: 0x06002210 RID: 8720 RVA: 0x000C2794 File Offset: 0x000C0994
        internal static MailboxFolderTree CreateMailboxFolderTree(UserContext userContext, MailboxSession mailboxSession, FolderTreeRenderType renderType, bool selectInbox)
        {
            MailboxFolderTree mailboxFolderTree = new MailboxFolderTree(userContext, mailboxSession, FolderTreeNode.CreateMailboxFolderTreeRootNode(userContext, mailboxSession, renderType), renderType);

            mailboxFolderTree.RootNode.IsExpanded = true;
            FolderTreeNode rootNode = mailboxFolderTree.RootNode;

            rootNode.HighlightClassName += " trNdGpHdHl";
            if (selectInbox)
            {
                StoreObjectId    defaultFolderId = Utilities.GetDefaultFolderId(mailboxSession, DefaultFolderType.Inbox);
                OwaStoreObjectId folderId;
                if (userContext.IsMyMailbox(mailboxSession))
                {
                    folderId = OwaStoreObjectId.CreateFromMailboxFolderId(defaultFolderId);
                }
                else
                {
                    folderId = OwaStoreObjectId.CreateFromOtherUserMailboxFolderId(defaultFolderId, mailboxSession.MailboxOwnerLegacyDN);
                }
                mailboxFolderTree.RootNode.SelectSpecifiedFolder(folderId);
            }
            return(mailboxFolderTree);
        }
        // Token: 0x06001EC6 RID: 7878 RVA: 0x000B13EC File Offset: 0x000AF5EC
        public string GetPrincipalCalendarFolderId(bool isCalendarItem)
        {
            string            result = null;
            ExchangePrincipal exchangePrincipal;

            if (this.CalendarItemBase != null && this.CalendarItemBase.ParentId != null)
            {
                OwaStoreObjectId owaStoreObjectId = OwaStoreObjectId.CreateFromOtherUserMailboxFolderId(this.CalendarItemBase.ParentId, Utilities.GetMailboxSessionLegacyDN(this.CalendarItemBase));
                result = owaStoreObjectId.ToBase64String();
            }
            else if (!isCalendarItem && this.UserContext.DelegateSessionManager.TryGetExchangePrincipal((this.meetingPageItem as MeetingMessage).ReceivedRepresenting.EmailAddress, out exchangePrincipal))
            {
                using (OwaStoreObjectIdSessionHandle owaStoreObjectIdSessionHandle = new OwaStoreObjectIdSessionHandle(exchangePrincipal, this.UserContext))
                {
                    OwaStoreObjectId owaStoreObjectId2 = Utilities.TryGetDefaultFolderId(this.UserContext, owaStoreObjectIdSessionHandle.Session as MailboxSession, DefaultFolderType.Calendar);
                    if (owaStoreObjectId2 == null)
                    {
                        throw new OwaAccessDeniedException(LocalizedStrings.GetNonEncoded(995407892));
                    }
                    result = owaStoreObjectId2.ToBase64String();
                }
            }
            return(result);
        }