Esempio n. 1
0
        // Token: 0x06002EB5 RID: 11957 RVA: 0x0010BEBC File Offset: 0x0010A0BC
        private void OpenOtherUserCalendar(RecipientInfoAC recipientInfo)
        {
            ExchangePrincipal exchangePrincipal = null;

            if (base.UserContext.DelegateSessionManager.TryGetExchangePrincipal(recipientInfo.RoutingAddress, out exchangePrincipal))
            {
                if (string.Equals(base.UserContext.MailboxSession.MailboxOwnerLegacyDN, exchangePrincipal.LegacyDn, StringComparison.OrdinalIgnoreCase))
                {
                    throw new OwaEventHandlerException("Cannot open own folder", LocalizedStrings.GetNonEncoded(-1770024075), true);
                }
                try
                {
                    NavigationNodeCollection.AddGSCalendarToSharedFoldersGroup(base.UserContext, exchangePrincipal);
                    OwaStoreObjectId owaStoreObjectId = OwaStoreObjectId.CreateFromGSCalendarLegacyDN(exchangePrincipal.LegacyDn);
                    NavigationHost.RenderFavoritesAndNavigationTrees(this.Writer, base.UserContext, owaStoreObjectId, new NavigationNodeGroupSection[]
                    {
                        NavigationNodeGroupSection.Calendar
                    });
                    this.RenderOpenOtherUserFolderReponse("IPF.Appointment", owaStoreObjectId);
                    return;
                }
                catch (OwaSharedFromOlderVersionException)
                {
                    throw new OwaEventHandlerException(LocalizedStrings.GetNonEncoded(995407892), LocalizedStrings.GetNonEncoded(1354015881), true);
                }
            }
            throw new OwaEventHandlerException("Cannot get the exchange principal of the target user when open other user's calendar", LocalizedStrings.GetNonEncoded(1988379659), true);
        }
 public void ReloadCalendarNavigationTree()
 {
     NavigationHost.RenderFavoritesAndNavigationTrees(this.Writer, base.UserContext, null, new NavigationNodeGroupSection[]
     {
         NavigationNodeGroupSection.Calendar
     });
 }
Esempio n. 3
0
        public void Move()
        {
            base.ThrowIfCannotActAsOwner();
            StoreObjectId nodeId  = (StoreObjectId)base.GetParameter("srcNId");
            StoreObjectId nodeId2 = (StoreObjectId)base.GetParameter("tgtid");
            int           num     = base.IsParameterSet("mt") ? ((int)base.GetParameter("mt")) : 0;
            NavigationNodeGroupSection navigationNodeGroupSection = (NavigationNodeGroupSection)base.GetParameter("GS");
            NavigationNodeCollection   navigationNodeCollection   = NavigationNodeCollection.TryCreateNavigationNodeCollection(base.UserContext, base.UserContext.MailboxSession, navigationNodeGroupSection);
            NavigationNode             navigationNode             = navigationNodeCollection.RemoveFolderOrGroupByNodeId(nodeId);

            if (navigationNode == null)
            {
                base.RenderPartialFailure(-289549140, OwaEventHandlerErrorCode.NotSet);
            }
            else
            {
                int num2;
                int num3;
                if (navigationNodeCollection.TryFindGroupAndNodeIndexByNodeId(nodeId2, out num2, out num3))
                {
                    if (navigationNode is NavigationNodeGroup)
                    {
                        if (num3 >= 0)
                        {
                            throw new OwaInvalidRequestException("The target node must be a navigation node group");
                        }
                        if (num != 1 && num != 2)
                        {
                            throw new OwaInvalidRequestException("Can only move a group before or after another group");
                        }
                        navigationNodeCollection.Insert((num == 2) ? (num2 + 1) : num2, navigationNode as NavigationNodeGroup);
                    }
                    else if (navigationNode is NavigationNodeFolder)
                    {
                        if (num3 >= 0)
                        {
                            if (num != 1 && num != 2)
                            {
                                throw new OwaInvalidRequestException("Can only move a folder before or after another folder");
                            }
                            navigationNodeCollection[num2].Children.Insert((num == 2) ? (num3 + 1) : num3, navigationNode as NavigationNodeFolder);
                        }
                        else
                        {
                            navigationNodeCollection[num2].Children.Add(navigationNode as NavigationNodeFolder);
                        }
                    }
                }
                else
                {
                    base.RenderPartialFailure((navigationNodeGroupSection == NavigationNodeGroupSection.First) ? 817935633 : 444965652, OwaEventHandlerErrorCode.NotSet);
                }
                navigationNodeCollection.Save(base.UserContext.MailboxSession);
            }
            NavigationHost.RenderFavoritesAndNavigationTrees(this.Writer, base.UserContext, null, new NavigationNodeGroupSection[]
            {
                navigationNodeGroupSection
            });
        }
 // Token: 0x060021FA RID: 8698 RVA: 0x000C23AC File Offset: 0x000C05AC
 protected void RenderReplaceFolderId()
 {
     if (!string.IsNullOrEmpty(this.archiveRootFolderId))
     {
         StringBuilder stringBuilder = new StringBuilder();
         stringBuilder.Append("<div id=\"divReplaceFolderId\" style=\"display:none\" oldfolderid =\"f");
         stringBuilder.Append(Utilities.HtmlEncode(base.SerializedContainerId));
         stringBuilder.Append("\" newfolderid =\"f");
         stringBuilder.Append(Utilities.HtmlEncode(this.archiveRootFolderId));
         stringBuilder.Append("\"></div>");
         base.Response.Write(stringBuilder.ToString());
         NavigationHost.RenderFavoritesAndNavigationTrees(base.Writer, base.UserContext, null, new NavigationNodeGroupSection[]
         {
             NavigationNodeGroupSection.First
         });
     }
 }
Esempio n. 5
0
        public void Expand()
        {
            ExTraceGlobals.MailCallTracer.TraceDebug((long)this.GetHashCode(), "TreeEventHandler.Expand");
            string text = (string)base.GetParameter("id");
            bool   flag = false;

            if (OwaStoreObjectId.IsDummyArchiveFolder(text))
            {
                text = base.UserContext.GetArchiveRootFolderIdString();
                flag = !string.IsNullOrEmpty(text);
            }
            this.RenderFolderTreeChangedNode(OwaStoreObjectId.CreateFromString(text), null, true, flag, (FolderTreeRenderType)base.GetParameter("rdt"));
            if (flag)
            {
                NavigationHost.RenderFavoritesAndNavigationTrees(this.Writer, base.UserContext, null, new NavigationNodeGroupSection[]
                {
                    NavigationNodeGroupSection.First
                });
            }
        }
Esempio n. 6
0
        public void SubscribeToInternetCalendar()
        {
            string iCalUrlString = (string)base.GetParameter("iCalUrl");

            try
            {
                SubscribeResultsWebCal subscribeResultsWebCal = WebCalendar.Subscribe(base.UserContext.MailboxSession, iCalUrlString, null);
                OwaStoreObjectId       newFolderId            = OwaStoreObjectId.CreateFromMailboxFolderId(subscribeResultsWebCal.LocalFolderId);
                NavigationHost.RenderFavoritesAndNavigationTrees(this.Writer, base.UserContext, newFolderId, new NavigationNodeGroupSection[]
                {
                    NavigationNodeGroupSection.Calendar
                });
            }
            catch (InvalidSharingDataException)
            {
                this.SanitizingWriter.Write("<div id=\"err\" _msg=\"badUri\"></div>");
            }
            catch (NotSupportedWithMailboxVersionException)
            {
                throw new OwaInvalidRequestException("Your account isn't set up to allow calendars to be added from the Internet.");
            }
        }
        public void AddFilterToFavorites()
        {
            string text = ((string)base.GetParameter("fltrSbj")).Trim();

            if (text.Length == 0)
            {
                throw new OwaEventHandlerException("User did not provide name for new folder", LocalizedStrings.GetNonEncoded(-41080803), true);
            }
            if (text.Length > 256)
            {
                text = text.Substring(0, 256);
            }
            base.BindToFolder();
            try
            {
                if (Utilities.IsDefaultFolder(base.ContextFolder, DefaultFolderType.DeletedItems) || Utilities.IsItemInDefaultFolder(base.ContextFolder, DefaultFolderType.DeletedItems) || Utilities.IsFavoritesFilterFolder(base.UserContext, base.ContextFolder))
                {
                    throw new OwaInvalidRequestException("Only normal folder or Outlook search folder can be filtered.");
                }
                if (base.FilteredFolder != null)
                {
                    NavigationNodeCollection navigationNodeCollection = NavigationNodeCollection.TryCreateNavigationNodeCollection(base.UserContext, base.UserContext.MailboxSession, NavigationNodeGroupSection.First);
                    if (navigationNodeCollection.FindFoldersById(base.FilteredFolder.Id.ObjectId).Length > 0)
                    {
                        throw new OwaEventHandlerException("Filtered view has already been added.", LocalizedStrings.GetNonEncoded(-44763698), true);
                    }
                    int num = 0;
                    foreach (NavigationNodeFolder navigationNodeFolder in navigationNodeCollection[0].Children)
                    {
                        if (navigationNodeFolder.IsValid && navigationNodeFolder.IsFilteredView)
                        {
                            num++;
                        }
                    }
                    if (num >= Globals.MaximumFilteredViewInFavoritesPerUser)
                    {
                        string description = string.Format(base.UserContext.UserCulture, LocalizedStrings.GetNonEncoded(-529843556), new object[]
                        {
                            Globals.MaximumFilteredViewInFavoritesPerUser
                        });
                        throw new OwaEventHandlerException("Filtered view exceeds budget.", description, true);
                    }
                    base.FilteredFolder[FolderSchema.SearchFolderAllowAgeout] = false;
                    base.FilteredFolder.DisplayName = text;
                    FolderSaveResult folderSaveResult = base.FilteredFolder.Save();
                    if (folderSaveResult.OperationResult != OperationResult.Succeeded)
                    {
                        if (Utilities.IsFolderNameConflictError(folderSaveResult))
                        {
                            throw new OwaEventHandlerException("Folder name exists", LocalizedStrings.GetNonEncoded(-1782850773), OwaEventHandlerErrorCode.FolderNameExists, true);
                        }
                        throw new OwaEventHandlerException("Fail to save folder properties.", LocalizedStrings.GetNonEncoded(-920350130), true);
                    }
                    else
                    {
                        base.FilteredFolder.Load(FolderList.FolderTreeQueryProperties);
                        NavigationNodeFolder navigationNodeFolder2 = navigationNodeCollection.AppendFolderToFavorites(base.FilteredFolder);
                        navigationNodeFolder2.SetFilterParameter(base.FilterCondition.SourceFolderId.StoreObjectId, base.FilterCondition.GetBooleanFlags(), base.FilterCondition.GetCategories(), base.FilterCondition.From, base.FilterCondition.To);
                        navigationNodeCollection.Save(base.UserContext.MailboxSession);
                        navigationNodeCollection = NavigationNodeCollection.TryCreateNavigationNodeCollection(base.UserContext, base.UserContext.MailboxSession, NavigationNodeGroupSection.First);
                        NavigationHost.RenderFavoritesAndNavigationTrees(this.Writer, base.UserContext, null, new NavigationNodeGroupSection[]
                        {
                            NavigationNodeGroupSection.First
                        });
                    }
                }
            }
            finally
            {
                this.EndProcessEvent();
            }
        }
Esempio n. 8
0
        public void OpenOtherUserFolder()
        {
            base.ThrowIfCannotActAsOwner();
            if (base.UserContext.IsExplicitLogon)
            {
                throw new OwaInvalidRequestException("Cannot open other's folder in explict logon mode");
            }
            NavigationNodeGroupSection navigationNodeGroupSection = (NavigationNodeGroupSection)base.GetParameter("GS");

            if (navigationNodeGroupSection == NavigationNodeGroupSection.Contacts || navigationNodeGroupSection == NavigationNodeGroupSection.Tasks)
            {
                throw new OwaInvalidRequestException("Cannot open other's contacts/tasks folder");
            }
            DefaultFolderType defaultFolderType;

            switch (navigationNodeGroupSection)
            {
            case NavigationNodeGroupSection.Mail:
                defaultFolderType = DefaultFolderType.Inbox;
                break;

            case NavigationNodeGroupSection.Calendar:
                defaultFolderType = DefaultFolderType.Calendar;
                break;

            case NavigationNodeGroupSection.Contacts:
                defaultFolderType = DefaultFolderType.Contacts;
                break;

            case NavigationNodeGroupSection.Tasks:
                defaultFolderType = DefaultFolderType.Tasks;
                break;

            default:
                throw new OwaInvalidRequestException("Invalid group section: " + navigationNodeGroupSection.ToString());
            }
            RecipientInfoAC[] array = (RecipientInfoAC[])base.GetParameter("Recips");
            if (array != null && array.Length != 0)
            {
                AutoCompleteCache.UpdateAutoCompleteCacheFromRecipientInfoList(array, base.OwaContext.UserContext);
            }
            if (defaultFolderType != DefaultFolderType.Calendar)
            {
                Folder folder = null;
                if (base.IsParameterSet("RCP"))
                {
                    RecipientInfoAC   recipientInfoAC   = (RecipientInfoAC)base.GetParameter("RCP");
                    ExchangePrincipal exchangePrincipal = null;
                    if (base.UserContext.DelegateSessionManager.TryGetExchangePrincipal(recipientInfoAC.RoutingAddress, out exchangePrincipal))
                    {
                        if (string.Equals(base.UserContext.MailboxSession.MailboxOwnerLegacyDN, exchangePrincipal.LegacyDn, StringComparison.OrdinalIgnoreCase))
                        {
                            throw new OwaEventHandlerException("Cannot open own folder", LocalizedStrings.GetNonEncoded(-1770024075), true);
                        }
                        folder = this.GetOtherUserFolder(exchangePrincipal, defaultFolderType);
                    }
                }
                else
                {
                    if (!base.IsParameterSet("Id"))
                    {
                        throw new OwaInvalidRequestException("Must specific one of recipient and folder Id.");
                    }
                    OwaStoreObjectId owaStoreObjectId = (OwaStoreObjectId)base.GetParameter("Id");
                    if (!owaStoreObjectId.IsOtherMailbox)
                    {
                        throw new OwaEventHandlerException("Cannot open own folder", LocalizedStrings.GetNonEncoded(-1770024075), true);
                    }
                    folder = Utilities.GetFolder <Folder>(base.UserContext, owaStoreObjectId, FolderList.FolderTreeQueryProperties);
                }
                try
                {
                    if (folder == null || !Utilities.CanReadItemInFolder(folder))
                    {
                        Strings.IDs localizedId = 1414246128;
                        switch (navigationNodeGroupSection)
                        {
                        case NavigationNodeGroupSection.Mail:
                            localizedId = -236167850;
                            break;

                        case NavigationNodeGroupSection.Contacts:
                            localizedId = -1505241540;
                            break;

                        case NavigationNodeGroupSection.Tasks:
                            localizedId = -65263937;
                            break;
                        }
                        throw new OwaEventHandlerException(LocalizedStrings.GetNonEncoded(995407892), LocalizedStrings.GetNonEncoded(localizedId), true);
                    }
                    MailboxSession mailboxSession = folder.Session as MailboxSession;
                    if (navigationNodeGroupSection == NavigationNodeGroupSection.Mail)
                    {
                        OtherMailboxConfigEntry otherMailboxConfigEntry = OtherMailboxConfiguration.AddOtherMailboxSession(base.UserContext, mailboxSession);
                        if (otherMailboxConfigEntry != null)
                        {
                            NavigationHost.RenderOtherMailboxFolderTree(this.Writer, base.UserContext, otherMailboxConfigEntry, true);
                        }
                    }
                    else
                    {
                        NavigationNodeCollection.AddNonMailFolderToSharedFoldersGroup(base.UserContext, folder, navigationNodeGroupSection);
                        OwaStoreObjectId owaStoreObjectId2 = OwaStoreObjectId.CreateFromStoreObject(folder);
                        NavigationHost.RenderFavoritesAndNavigationTrees(this.Writer, base.UserContext, owaStoreObjectId2, new NavigationNodeGroupSection[]
                        {
                            navigationNodeGroupSection
                        });
                        this.RenderOpenOtherUserFolderReponse(folder.ClassName, owaStoreObjectId2);
                    }
                }
                finally
                {
                    if (folder != null)
                    {
                        folder.Dispose();
                    }
                }
                return;
            }
            if (!base.IsParameterSet("RCP"))
            {
                throw new OwaInvalidRequestException("Recipient is missing for open other user's calendar request");
            }
            this.OpenOtherUserCalendar((RecipientInfoAC)base.GetParameter("RCP"));
        }
Esempio n. 9
0
        public void AddToFavorites()
        {
            base.ThrowIfCannotActAsOwner();
            OwaStoreObjectId owaStoreObjectId = (OwaStoreObjectId)base.GetParameter("Id");

            if (owaStoreObjectId.OwaStoreObjectIdType != OwaStoreObjectIdType.MailBoxObject && owaStoreObjectId.OwaStoreObjectIdType != OwaStoreObjectIdType.ArchiveMailboxObject)
            {
                throw new OwaInvalidRequestException("Only mailbox objects can be added to favorites.");
            }
            using (Folder folder = Utilities.GetFolder <Folder>(base.UserContext, owaStoreObjectId, FolderList.FolderTreeQueryProperties))
            {
                if (Utilities.IsDefaultFolder(folder, DefaultFolderType.Root))
                {
                    throw new OwaInvalidRequestException("Cannot add root folder to favorites.");
                }
                if (!string.IsNullOrEmpty(folder.ClassName) && !ObjectClass.IsOfClass(folder.ClassName, "IPF.Note"))
                {
                    throw new OwaInvalidRequestException("Only mail folder can be added to favorites.");
                }
                if (Utilities.IsDefaultFolder(folder, DefaultFolderType.SearchFolders))
                {
                    throw new OwaInvalidRequestException("Cannot add search folder root to favorites.");
                }
                NavigationNodeCollection navigationNodeCollection = NavigationNodeCollection.TryCreateNavigationNodeCollection(base.UserContext, base.UserContext.MailboxSession, NavigationNodeGroupSection.First);
                navigationNodeCollection.RemoveFolderByLegacyDNandId(((MailboxSession)folder.Session).MailboxOwnerLegacyDN, owaStoreObjectId.StoreObjectId);
                if (base.IsParameterSet("tgtid"))
                {
                    StoreObjectId storeObjectId = (StoreObjectId)base.GetParameter("tgtid");
                }
                if (base.IsParameterSet("tgtid"))
                {
                    int num = navigationNodeCollection[0].Children.FindChildByNodeId((StoreObjectId)base.GetParameter("tgtid"));
                    if (num < 0)
                    {
                        base.RenderPartialFailure(817935633, OwaEventHandlerErrorCode.NotSet);
                    }
                    else
                    {
                        if (base.IsParameterSet("mt"))
                        {
                            int num2 = (int)base.GetParameter("mt");
                            if (num2 != 1 && num2 != 2)
                            {
                                throw new OwaInvalidRequestException("Only before or after is valid.");
                            }
                            if (num2 == 2)
                            {
                                num++;
                            }
                        }
                        navigationNodeCollection.InsertMyFolderToFavorites(folder, num);
                    }
                }
                else
                {
                    navigationNodeCollection.AppendFolderToFavorites(folder);
                }
                navigationNodeCollection.Save(base.UserContext.MailboxSession);
            }
            NavigationHost.RenderFavoritesAndNavigationTrees(this.Writer, base.UserContext, null, new NavigationNodeGroupSection[]
            {
                NavigationNodeGroupSection.First
            });
        }