// 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);
        }
예제 #2
0
        public void AddSharedCalendar()
        {
            using (SharingMessageItem requestItem = base.GetRequestItem <SharingMessageItem>(new PropertyDefinition[0]))
            {
                if (requestItem == null || !requestItem.SharingMessageType.IsInvitationOrAcceptOfRequest || requestItem.SharedFolderType != DefaultFolderType.Calendar)
                {
                    throw new OwaInvalidRequestException("Not a calendar sharing message");
                }
                this.ValidateSharingAction(SharingAction.AddCalendar, requestItem);
                SubscribeResults subscribeResults = null;
                try
                {
                    subscribeResults = requestItem.SubscribeAndOpen();
                }
                catch (NotSupportedWithMailboxVersionException)
                {
                    throw new OwaInvalidRequestException("Your account isn't set up to allow calendars to be added from the Internet.");
                }
                catch (StoragePermanentException ex)
                {
                    string message = string.Format("Unable to subscribe shared calendar folder. Exception {0}", ex.Message);
                    ExTraceGlobals.CalendarCallTracer.TraceDebug(0L, message);
                    this.RenderSubscriptionError(ex);
                    return;
                }
                if (subscribeResults is SubscribeResultsInternal)
                {
                    SubscribeResultsInternal subscribeResultsInternal = (SubscribeResultsInternal)subscribeResults;
                    string            text = StoreEntryId.TryParseMailboxLegacyDN(subscribeResultsInternal.RemoteMailboxId);
                    ExchangePrincipal exchangePrincipal;
                    if (base.UserContext.DelegateSessionManager.TryGetExchangePrincipal(text, out exchangePrincipal))
                    {
                        try
                        {
                            if (requestItem.IsSharedFolderPrimary)
                            {
                                if (!string.Equals(text, base.UserContext.MailboxOwnerLegacyDN, StringComparison.OrdinalIgnoreCase))
                                {
                                    NavigationNodeCollection.AddGSCalendarToSharedFoldersGroup(base.UserContext, exchangePrincipal);
                                }
                            }
                            else
                            {
                                using (OwaStoreObjectIdSessionHandle owaStoreObjectIdSessionHandle = new OwaStoreObjectIdSessionHandle(exchangePrincipal, base.UserContext))
                                {
                                    OwaStoreObjectId folderId = OwaStoreObjectId.CreateFromSessionFolderId(base.UserContext, owaStoreObjectIdSessionHandle.Session, subscribeResultsInternal.RemoteFolderId);
                                    using (Folder folder = Utilities.GetFolder <Folder>(base.UserContext, folderId, FolderList.FolderTreeQueryProperties))
                                    {
                                        if (!Utilities.CanReadItemInFolder(folder))
                                        {
                                            this.RenderNotFoundResponse();
                                            return;
                                        }
                                        NavigationNodeCollection.AddNonMailFolderToSharedFoldersGroup(base.UserContext, folder, NavigationNodeGroupSection.Calendar);
                                    }
                                }
                            }
                            goto IL_1A2;
                        }
                        catch (OwaSharedFromOlderVersionException)
                        {
                            this.RenderSharedFromE12Response();
                            return;
                        }
                        catch (ObjectNotFoundException)
                        {
                            this.RenderNotFoundResponse();
                            return;
                        }
                    }
                    this.RenderNotFoundResponse();
                    return;
                }
                if (subscribeResults is SubscribeResultsExternal)
                {
                    OwaStoreObjectId folderId = OwaStoreObjectId.CreateFromMailboxFolderId(((SubscribeResultsExternal)subscribeResults).LocalFolderId);
                }
IL_1A2:
                this.RenderChangeKey(requestItem);
                ExDateTime now = ExDateTime.GetNow(base.UserContext.TimeZone);
                this.Writer.Write("<div id=\"subInfo\">");
                this.Writer.Write(SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(388258761), new object[]
                {
                    now.ToString(base.UserContext.UserOptions.DateFormat),
                    now.ToString(base.UserContext.UserOptions.TimeFormat)
                }));
                this.Writer.Write("</div>");
                RenderingUtilities.RenderNavigationTreeDirtyFlag(this.Writer, base.UserContext, NavigationTreeDirtyFlag.Calendar, new NavigationModule[]
                {
                    NavigationModule.Calendar
                });
            }
        }