예제 #1
0
        public static NavigationTree CreateNavigationTree(UserContext userContext, NavigationNodeGroupSection groupSection)
        {
            List <FolderList> folderLists = new List <FolderList>();

            folderLists.Add(new FolderList(userContext, userContext.MailboxSession, new string[]
            {
                NavigationNode.GetFolderClass(groupSection)
            }, 10000, false, null, FolderList.FolderTreeQueryProperties));
            if (userContext.ArchiveAccessed)
            {
                userContext.TryLoopArchiveMailboxes(delegate(MailboxSession archiveSession)
                {
                    folderLists.Add(new FolderList(userContext, archiveSession, new string[]
                    {
                        NavigationNode.GetFolderClass(groupSection)
                    }, 10000, false, null, FolderList.FolderTreeQueryProperties));
                });
            }
            NavigationNodeCollection navigationNodeCollection = NavigationNodeCollection.TryCreateNavigationNodeCollection(userContext, userContext.MailboxSession, groupSection);

            return(NavigationTree.CreateNavigationTreeByFolderLists(userContext, folderLists.ToArray(), new NavigationNodeCollection[]
            {
                navigationNodeCollection
            })[0]);
        }
예제 #2
0
        private static byte[] GetFolderTypeClassId(NavigationNodeGroupSection navigationNodeGroupSection)
        {
            switch (navigationNodeGroupSection)
            {
            case NavigationNodeGroupSection.First:
                return(NavigationNode.MailFavoritesClassId.ToByteArray());

            case NavigationNodeGroupSection.Mail:
                return(NavigationNode.MailClassId.ToByteArray());

            case NavigationNodeGroupSection.Calendar:
                return(NavigationNode.CalendarClassId.ToByteArray());

            case NavigationNodeGroupSection.Contacts:
                return(NavigationNode.ContactsClassId.ToByteArray());

            case NavigationNodeGroupSection.Tasks:
                return(NavigationNode.TasksClassId.ToByteArray());

            case NavigationNodeGroupSection.Notes:
                return(NavigationNode.NotesClassId.ToByteArray());

            case NavigationNodeGroupSection.Journal:
                return(NavigationNode.JournalClassId.ToByteArray());

            default:
                throw new ArgumentOutOfRangeException("navigationNodeGroupSection");
            }
        }
예제 #3
0
        public void AddNewGroup()
        {
            base.ThrowIfCannotActAsOwner();
            string text = ((string)base.GetParameter("SB")).Trim();

            if (text.Length == 0)
            {
                throw new OwaEventHandlerException("User did not provide name for new group", LocalizedStrings.GetNonEncoded(-1749891264), true);
            }
            NavigationNodeGroupSection navigationNodeGroupSection = (NavigationNodeGroupSection)base.GetParameter("GS");
            NavigationNodeCollection   navigationNodeCollection   = NavigationNodeCollection.TryCreateNavigationNodeCollection(base.UserContext, base.UserContext.MailboxSession, navigationNodeGroupSection);
            NavigationNodeGroup        navigationNodeGroup        = NavigationNodeCollection.CreateCustomizedGroup(navigationNodeGroupSection, text);
            Guid navigationNodeGroupClassId = navigationNodeGroup.NavigationNodeGroupClassId;

            navigationNodeCollection.Add(navigationNodeGroup);
            navigationNodeCollection.Save(base.UserContext.MailboxSession);
            navigationNodeCollection = NavigationNodeCollection.TryCreateNavigationNodeCollection(base.UserContext, base.UserContext.MailboxSession, navigationNodeGroupSection);
            navigationNodeGroup      = navigationNodeCollection[navigationNodeCollection.FindGroupById(navigationNodeGroupClassId)];
            NavigationGroupHeaderTreeNode navigationGroupHeaderTreeNode  = new NavigationGroupHeaderTreeNode(base.UserContext, navigationNodeGroup);
            NavigationGroupHeaderTreeNode navigationGroupHeaderTreeNode2 = navigationGroupHeaderTreeNode;

            navigationGroupHeaderTreeNode2.CustomAttributes += " _NF=1";
            this.Writer.Write("<div id=ntn>");
            navigationGroupHeaderTreeNode.RenderUndecoratedNode(this.Writer);
            this.Writer.Write("</div>");
        }
예제 #4
0
        private static void ThrowIfGroupSectionNotMatchFolderClass(NavigationNodeGroupSection groupSection, string folderClass)
        {
            switch (groupSection)
            {
            case NavigationNodeGroupSection.First:
                if (string.IsNullOrEmpty(folderClass) || ObjectClass.IsOfClass(folderClass, "IPF.Note"))
                {
                    return;
                }
                break;

            case NavigationNodeGroupSection.Calendar:
                if (ObjectClass.IsOfClass(folderClass, "IPF.Appointment"))
                {
                    return;
                }
                break;

            case NavigationNodeGroupSection.Contacts:
                if (ObjectClass.IsOfClass(folderClass, "IPF.Contact"))
                {
                    return;
                }
                break;

            case NavigationNodeGroupSection.Tasks:
                if (ObjectClass.IsOfClass(folderClass, "IPF.Task"))
                {
                    return;
                }
                break;
            }
            throw new InvalidOperationException(string.Format("The folder container class \"{0}\" doesn't match the group section \"{1}\".", folderClass, groupSection.ToString()));
        }
예제 #5
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
            });
        }
예제 #6
0
 public static NavigationNodeGroup CreateCustomizedGroup(NavigationNodeGroupSection groupSection, string groupSubject)
 {
     if (groupSubject == null)
     {
         throw new ArgumentNullException("groupSubject");
     }
     return(NavigationNodeCollection.CreateCustomizedGroup(groupSection, groupSubject, Guid.NewGuid()));
 }
예제 #7
0
 private static NavigationNodeGroup CreateCustomizedGroup(NavigationNodeGroupSection groupSection, string groupSubject, Guid groupClassId)
 {
     if (groupClassId.Equals(Guid.Empty))
     {
         throw new ArgumentException("groupClassId should not be empty");
     }
     return(new NavigationNodeGroup(groupSubject, groupSection, groupClassId));
 }
예제 #8
0
        private static bool CheckItemClassAndSection(NavigationNodeGroupSection navigationNodeGroupSection, object[] row)
        {
            object obj = row[NavigationNodeCollection.PropertyMap[NavigationNodeSchema.GroupSection]];

            if (!(obj is int))
            {
                return(false);
            }
            string text = row[NavigationNodeCollection.PropertyMap[StoreObjectSchema.ItemClass]] as string;

            return(text != null && text.Equals("IPM.Microsoft.WunderBar.Link", StringComparison.OrdinalIgnoreCase) && navigationNodeGroupSection == (NavigationNodeGroupSection)obj);
        }
예제 #9
0
 public void PersistExpandStatus()
 {
     base.ThrowIfCannotActAsOwner();
     if (!base.UserContext.IsWebPartRequest)
     {
         NavigationNodeGroupSection navigationNodeGroupSection = (NavigationNodeGroupSection)base.GetParameter("GS");
         NavigationNodeCollection   navigationNodeCollection   = NavigationNodeCollection.TryCreateNavigationNodeCollection(base.UserContext, base.UserContext.MailboxSession, navigationNodeGroupSection);
         int num = navigationNodeCollection.FindChildByNodeId((StoreObjectId)base.GetParameter("srcNId"));
         if (num >= 0)
         {
             navigationNodeCollection[num].IsExpanded = (bool)base.GetParameter("exp");
             navigationNodeCollection.Save(base.UserContext.MailboxSession);
         }
     }
 }
예제 #10
0
        internal static string GetFolderClass(NavigationNodeGroupSection groupSection)
        {
            switch (groupSection)
            {
            case NavigationNodeGroupSection.Calendar:
                return("IPF.Appointment");

            case NavigationNodeGroupSection.Contacts:
                return("IPF.Contact");

            case NavigationNodeGroupSection.Tasks:
                return("IPF.Task");

            default:
                return("IPF.Note");
            }
        }
예제 #11
0
        // Token: 0x0600243E RID: 9278 RVA: 0x000D1988 File Offset: 0x000CFB88
        private static string GetNavigationTreeRegionId(NavigationNodeGroupSection groupSection)
        {
            switch (groupSection)
            {
            case NavigationNodeGroupSection.Calendar:
                return("divCalTrR");

            case NavigationNodeGroupSection.Contacts:
                return("divCntTrR");

            case NavigationNodeGroupSection.Tasks:
                return("divTskTrR");

            default:
                throw new ArgumentException("Navigation tree is only available in calendar, contact and task.");
            }
        }
예제 #12
0
        // Token: 0x0600243D RID: 9277 RVA: 0x000D1938 File Offset: 0x000CFB38
        private static string GetNavigationTreeId(NavigationNodeGroupSection groupSection)
        {
            switch (groupSection)
            {
            case NavigationNodeGroupSection.First:
                return("favTr");

            case NavigationNodeGroupSection.Calendar:
                return("calTr");

            case NavigationNodeGroupSection.Contacts:
                return("cntTr");

            case NavigationNodeGroupSection.Tasks:
                return("tskTr");
            }
            throw new ArgumentException("Navigation tree is only available in calendar, contact and task.");
        }
예제 #13
0
        // Token: 0x0600243F RID: 9279 RVA: 0x000D19CC File Offset: 0x000CFBCC
        private static string GetNavigationTreeErrDivId(NavigationNodeGroupSection groupSection)
        {
            switch (groupSection)
            {
            case NavigationNodeGroupSection.First:
                return("divErrMail");

            case NavigationNodeGroupSection.Calendar:
                return("divErrCal");

            case NavigationNodeGroupSection.Contacts:
                return("divErrCnt");

            case NavigationNodeGroupSection.Tasks:
                return("divErrTsk");
            }
            throw new ArgumentException("Navigation tree is only available in calendar, contact and task.");
        }
예제 #14
0
 protected NavigationNode(NavigationNodeType navigationNodeType, string subject, NavigationNodeGroupSection navigationNodeGroupSection)
 {
     this.propertyBag = new MemoryPropertyBag();
     this.propertyBag.SetAllPropertiesLoaded();
     this.NavigationNodeType         = navigationNodeType;
     this.Subject                    = subject;
     this.NavigationNodeFlags        = NavigationNodeFlags.None;
     this.NavigationNodeClassId      = NavigationNode.GetFolderTypeClassId(navigationNodeGroupSection);
     this.NavigationNodeGroupSection = navigationNodeGroupSection;
     this.propertyBag.Load(null);
     this.isNew = true;
 }
예제 #15
0
 private static NavigationNodeGroup CreateDefaultGroup(NavigationNodeGroupType groupType, NavigationNodeGroupSection groupSection)
 {
     return(new NavigationNodeGroup(NavigationNodeCollection.GetDefaultGroupSubject(groupType, groupSection), groupSection, NavigationNodeCollection.GetDefaultGroupClassId(groupType)));
 }
예제 #16
0
 internal static string GetDefaultGroupSubject(NavigationNodeGroupType groupType, NavigationNodeGroupSection groupSection)
 {
     if (groupSection == NavigationNodeGroupSection.First)
     {
         return(LocalizedStrings.GetNonEncoded(364750115));
     }
     return(LocalizedStrings.GetNonEncoded(NavigationNodeCollection.localizedGroupNames[groupSection][(int)groupType]));
 }
예제 #17
0
        public void Remove()
        {
            base.ThrowIfCannotActAsOwner();
            StoreObjectId nodeId = (StoreObjectId)base.GetParameter("srcNId");
            NavigationNodeGroupSection navigationNodeGroupSection = (NavigationNodeGroupSection)base.GetParameter("GS");
            NavigationNodeCollection   navigationNodeCollection   = NavigationNodeCollection.TryCreateNavigationNodeCollection(base.UserContext, base.UserContext.MailboxSession, navigationNodeGroupSection);
            List <OwaStoreObjectId>    list           = new List <OwaStoreObjectId>();
            NavigationNode             navigationNode = navigationNodeCollection.FindNavigationNodeByNodeId(nodeId);

            if (navigationNode == null)
            {
                base.RenderPartialFailure(-289549140, OwaEventHandlerErrorCode.NotSet);
            }
            else
            {
                OperationResult operationResult = (OperationResult)0;
                if (navigationNodeGroupSection != NavigationNodeGroupSection.First)
                {
                    List <NavigationNodeFolder> list2 = new List <NavigationNodeFolder>();
                    if (navigationNode is NavigationNodeFolder)
                    {
                        list2.Add(navigationNode as NavigationNodeFolder);
                    }
                    else if (navigationNode is NavigationNodeGroup)
                    {
                        NavigationNodeGroup navigationNodeGroup = navigationNode as NavigationNodeGroup;
                        foreach (NavigationNodeFolder item in navigationNodeGroup.Children)
                        {
                            list2.Add(item);
                        }
                    }
                    foreach (NavigationNodeFolder navigationNodeFolder in list2)
                    {
                        if (navigationNodeFolder.IsValid)
                        {
                            OwaStoreObjectId owaStoreObjectId = OwaStoreObjectId.CreateFromNavigationNodeFolder(base.UserContext, navigationNodeFolder);
                            MailboxSession   mailboxSession   = owaStoreObjectId.IsArchive ? ((MailboxSession)owaStoreObjectId.GetSession(base.UserContext)) : base.UserContext.MailboxSession;
                            if (navigationNodeFolder.IsFolderInSpecificMailboxSession(mailboxSession))
                            {
                                if (Utilities.IsSpecialFolderForSession(mailboxSession, navigationNodeFolder.FolderId))
                                {
                                    throw new OwaEventHandlerException("Cannot delete default folders.", LocalizedStrings.GetNonEncoded(-1164567320), true);
                                }
                                if (operationResult == (OperationResult)0)
                                {
                                    operationResult = OperationResult.Succeeded;
                                }
                                AggregateOperationResult aggregateOperationResult = mailboxSession.Delete(DeleteItemFlags.MoveToDeletedItems, new StoreId[]
                                {
                                    navigationNodeFolder.FolderId
                                });
                                if (aggregateOperationResult.OperationResult == OperationResult.Succeeded)
                                {
                                    list.Add(OwaStoreObjectId.CreateFromNavigationNodeFolder(base.UserContext, navigationNodeFolder));
                                }
                                else
                                {
                                    operationResult = OperationResult.PartiallySucceeded;
                                }
                            }
                        }
                    }
                    if (operationResult != (OperationResult)0 && list.Count == 0)
                    {
                        operationResult = OperationResult.Failed;
                    }
                    if (operationResult == OperationResult.Failed)
                    {
                        base.RenderPartialFailure(1041829989, OwaEventHandlerErrorCode.NotSet);
                    }
                    else if (operationResult == OperationResult.PartiallySucceeded)
                    {
                        base.RenderPartialFailure(995407892, OwaEventHandlerErrorCode.NotSet);
                    }
                }
                else
                {
                    NavigationNodeFolder navigationNodeFolder2 = navigationNode as NavigationNodeFolder;
                    if (navigationNodeFolder2 != null && navigationNodeFolder2.IsFilteredView)
                    {
                        OwaStoreObjectId owaStoreObjectId2 = OwaStoreObjectId.CreateFromNavigationNodeFolder(base.UserContext, navigationNodeFolder2);
                        using (SearchFolder searchFolder = SearchFolder.Bind(owaStoreObjectId2.GetSession(base.UserContext), owaStoreObjectId2.StoreObjectId, FolderList.FolderTreeQueryProperties))
                        {
                            searchFolder[FolderSchema.SearchFolderAllowAgeout] = true;
                            searchFolder.DisplayName = Utilities.GetRandomNameForTempFilteredView(base.UserContext);
                            searchFolder.Save();
                        }
                    }
                }
                if (operationResult == (OperationResult)0 || operationResult == OperationResult.Succeeded)
                {
                    if (navigationNodeCollection.RemoveFolderOrGroupByNodeId(nodeId) != null)
                    {
                        navigationNodeCollection.Save(base.UserContext.MailboxSession);
                    }
                }
                else if (operationResult == OperationResult.PartiallySucceeded)
                {
                    foreach (OwaStoreObjectId owaStoreObjectId3 in list)
                    {
                        navigationNodeCollection.RemoveFolderByLegacyDNandId(owaStoreObjectId3.MailboxOwnerLegacyDN ?? base.UserContext.MailboxOwnerLegacyDN, owaStoreObjectId3.StoreObjectId);
                    }
                    navigationNodeCollection.Save(base.UserContext.MailboxSession);
                }
            }
            NavigationTreeDirtyFlag navigationTreeDirtyFlag = NavigationTreeDirtyFlag.None;

            if (navigationNodeGroupSection == NavigationNodeGroupSection.First)
            {
                navigationTreeDirtyFlag = NavigationTreeDirtyFlag.Favorites;
            }
            else
            {
                if (list.Count > 0)
                {
                    List <FolderTreeNode> list3 = FolderTreeNode.CreateDeletedNodesWithDirtyCheck(base.UserContext, list, out navigationTreeDirtyFlag);
                    this.Writer.Write("<div id=tn>");
                    foreach (FolderTreeNode folderTreeNode in list3)
                    {
                        folderTreeNode.RenderUndecoratedNode(this.Writer);
                    }
                    this.Writer.Write("</div>");
                }
                switch (navigationNodeGroupSection)
                {
                case NavigationNodeGroupSection.Calendar:
                    navigationTreeDirtyFlag |= NavigationTreeDirtyFlag.Calendar;
                    break;

                case NavigationNodeGroupSection.Contacts:
                    navigationTreeDirtyFlag |= NavigationTreeDirtyFlag.Contact;
                    break;

                case NavigationNodeGroupSection.Tasks:
                    navigationTreeDirtyFlag |= NavigationTreeDirtyFlag.Task;
                    break;
                }
            }
            RenderingUtilities.RenderNavigationTreeDirtyFlag(this.Writer, base.UserContext, navigationTreeDirtyFlag, (NavigationModule[])base.GetParameter("cms"));
        }
예제 #18
0
 public static NavigationNodeCollection TryCreateNavigationNodeCollection(UserContext userContext, MailboxSession session, NavigationNodeGroupSection navigationNodeGroupSection)
 {
     return(NavigationNodeCollection.TryCreateNavigationNodeCollections(userContext, session, new NavigationNodeGroupSection[]
     {
         navigationNodeGroupSection
     })[0]);
 }
예제 #19
0
        internal NavigationNodeFolder(Folder folder, bool isMyFolder, string subject, NavigationNodeType navigationNodeType, Guid groupClassId, NavigationNodeGroupSection navigationNodeGroupSection, string groupName) : base(navigationNodeType, subject, navigationNodeGroupSection)
        {
            if (navigationNodeType == NavigationNodeType.Header || navigationNodeType == NavigationNodeType.Undefined)
            {
                throw new ArgumentException("The type should not be header for folders.");
            }
            MailboxSession mailboxSession = folder.Session as MailboxSession;

            if (mailboxSession == null)
            {
                throw new ArgumentException("The folder doesn't belong to a mailbox session.");
            }
            this.Initialize(mailboxSession, isMyFolder, folder.Id.ObjectId, folder.TryGetProperty(StoreObjectSchema.RecordKey), folder.GetValueOrDefault <ExtendedFolderFlags>(FolderSchema.ExtendedFolderFlags), groupClassId, groupName);
            if (navigationNodeType == NavigationNodeType.SmartFolder)
            {
                object obj = folder.TryGetProperty(FolderSchema.OutlookSearchFolderClsId);
                if (obj is Guid)
                {
                    this.AssociatedSearchFolderId = (Guid)obj;
                }
            }
            base.ClearDirty();
        }
예제 #20
0
        public void Rename()
        {
            base.ThrowIfCannotActAsOwner();
            string text = ((string)base.GetParameter("SB")).Trim();
            string s    = text;
            NavigationNodeGroupSection navigationNodeGroupSection = (NavigationNodeGroupSection)base.GetParameter("GS");
            NavigationNodeCollection   navigationNodeCollection   = NavigationNodeCollection.TryCreateNavigationNodeCollection(base.UserContext, base.UserContext.MailboxSession, navigationNodeGroupSection);
            NavigationNode             navigationNode             = navigationNodeCollection.FindNavigationNodeByNodeId((StoreObjectId)base.GetParameter("srcNId"));

            if (navigationNode == null)
            {
                throw new OwaEventHandlerException("Cannot find specified navigation node", LocalizedStrings.GetNonEncoded(-289549140), true);
            }
            if (text.Length != 0)
            {
                if (navigationNode is NavigationNodeFolder)
                {
                    NavigationNodeFolder navigationNodeFolder = navigationNode as NavigationNodeFolder;
                    if (!navigationNodeFolder.IsValid)
                    {
                        throw new OwaInvalidRequestException("This is not a valid navigation node");
                    }
                    if (navigationNodeFolder.NavigationNodeType == NavigationNodeType.SmartFolder && !navigationNodeFolder.IsFilteredView)
                    {
                        throw new OwaInvalidRequestException("Cannot rename search folders");
                    }
                    OwaStoreObjectId owaStoreObjectId = OwaStoreObjectId.CreateFromNavigationNodeFolder(base.UserContext, navigationNodeFolder);
                    MailboxSession   mailboxSession   = owaStoreObjectId.IsArchive ? ((MailboxSession)owaStoreObjectId.GetSession(base.UserContext)) : base.UserContext.MailboxSession;
                    if (owaStoreObjectId.IsArchive && navigationNodeFolder.NavigationNodeType == NavigationNodeType.NormalFolder)
                    {
                        s = string.Format(LocalizedStrings.GetNonEncoded(-83764036), text, Utilities.GetMailboxOwnerDisplayName(mailboxSession));
                    }
                    if (navigationNodeFolder.IsFolderInSpecificMailboxSession(mailboxSession))
                    {
                        using (Folder folder = Folder.Bind(mailboxSession, navigationNodeFolder.FolderId, new PropertyDefinition[]
                        {
                            FolderSchema.ExtendedFolderFlags
                        }))
                        {
                            if (!Utilities.CanFolderBeRenamed(base.UserContext, folder))
                            {
                                throw new OwaInvalidRequestException("Folder cannot be renamed.");
                            }
                            folder.DisplayName = text;
                            FolderSaveResult folderSaveResult = folder.Save();
                            if (folderSaveResult.OperationResult != OperationResult.Succeeded)
                            {
                                if (Utilities.IsFolderNameConflictError(folderSaveResult))
                                {
                                    throw new OwaEventHandlerException("Folder rename did not return OperationResult.Succeeded", LocalizedStrings.GetNonEncoded(1602494619), OwaEventHandlerErrorCode.FolderNameExists, true);
                                }
                                throw new OwaAccessDeniedException(LocalizedStrings.GetNonEncoded(995407892));
                            }
                        }
                    }
                }
                navigationNode.Subject = text;
                navigationNodeCollection.Save(base.UserContext.MailboxSession);
                this.Writer.Write("<div id=tn>");
                Utilities.HtmlEncode(text, this.Writer, true);
                this.Writer.Write("</div><div id=ntn>");
                Utilities.HtmlEncode(s, this.Writer, true);
                this.Writer.Write("</div>");
                return;
            }
            if (navigationNode is NavigationNodeGroup)
            {
                throw new OwaEventHandlerException("User did not provide name for new group", LocalizedStrings.GetNonEncoded(-1749891264), true);
            }
            throw new OwaEventHandlerException("User did not provide name for new folder", LocalizedStrings.GetNonEncoded(-41080803), true);
        }
예제 #21
0
        internal static NavigationNodeFolder CreateGSNode(ExchangePrincipal exchangePrincipal, Guid groupClassId, string groupName, string subject, NavigationNodeGroupSection navigationNodeGroupSection)
        {
            NavigationNodeFolder navigationNodeFolder = new NavigationNodeFolder(subject, navigationNodeGroupSection);

            navigationNodeFolder.GSCalendarSharerAddressBookEntryId = AddressBookEntryId.MakeAddressBookEntryID(exchangePrincipal);
            UserContext userContext = OwaContext.Current.UserContext;

            navigationNodeFolder.GSCalendarShareeStoreEntryId = StoreEntryId.ToProviderStoreEntryId(userContext.ExchangePrincipal);
            try
            {
                using (OwaStoreObjectIdSessionHandle owaStoreObjectIdSessionHandle = new OwaStoreObjectIdSessionHandle(exchangePrincipal, userContext))
                {
                    try
                    {
                        using (Folder folder = Folder.Bind(owaStoreObjectIdSessionHandle.Session as MailboxSession, DefaultFolderType.Calendar, new PropertyDefinition[]
                        {
                            StoreObjectSchema.EffectiveRights
                        }))
                        {
                            if (CalendarUtilities.UserHasRightToLoad(folder))
                            {
                                navigationNodeFolder.NavigationNodeEntryId      = folder.StoreObjectId.ProviderLevelItemId;
                                navigationNodeFolder.NavigationNodeStoreEntryId = StoreEntryId.ToProviderStoreEntryId(exchangePrincipal);
                            }
                        }
                    }
                    catch (ObjectNotFoundException)
                    {
                    }
                }
            }
            catch (OwaSharedFromOlderVersionException)
            {
            }
            navigationNodeFolder.ClearDirty();
            return(navigationNodeFolder);
        }
예제 #22
0
 private NavigationNodeFolder(string subject, NavigationNodeGroupSection navigationNodeGroupSection) : base(NavigationNodeType.SharedFolder, subject, navigationNodeGroupSection)
 {
 }
예제 #23
0
        // Token: 0x06002440 RID: 9280 RVA: 0x000D1A1C File Offset: 0x000CFC1C
        internal static void RenderNavigationTreeControl(TextWriter writer, UserContext userContext, NavigationNodeGroupSection groupSection, OwaStoreObjectId newFolderId)
        {
            if (groupSection == NavigationNodeGroupSection.First)
            {
                throw new ArgumentException("Should not use this function to render favorites tree.");
            }
            string navigationTreeErrDivId = NavigationHost.GetNavigationTreeErrDivId(groupSection);
            string navigationTreeId       = NavigationHost.GetNavigationTreeId(groupSection);
            string navigationTreeRegionId = NavigationHost.GetNavigationTreeRegionId(groupSection);

            writer.Write("<div id=\"");
            writer.Write(navigationTreeRegionId);
            writer.Write("\">");
            Infobar infobar = new Infobar(navigationTreeErrDivId, "infobar");

            infobar.Render(writer);
            NavigationHost.RenderTreeRegionDivStart(writer, null);
            NavigationTree navigationTree = NavigationTree.CreateNavigationTree(userContext, groupSection);

            if (newFolderId != null)
            {
                navigationTree.RootNode.SelectSpecifiedFolder(newFolderId);
            }
            NavigationHost.RenderTreeDivStart(writer, navigationTreeId);
            navigationTree.ErrDiv = navigationTreeErrDivId;
            navigationTree.Render(writer);
            NavigationHost.RenderTreeDivEnd(writer);
            NavigationHost.RenderTreeRegionDivEnd(writer);
            writer.Write("</div>");
        }
예제 #24
0
        public void AddNewFolder()
        {
            base.ThrowIfCannotActAsOwner();
            string text = ((string)base.GetParameter("SB")).Trim();

            if (text.Length == 0)
            {
                throw new OwaEventHandlerException("User did not provide name for new folder", LocalizedStrings.GetNonEncoded(-41080803), true);
            }
            NavigationNodeGroupSection navigationNodeGroupSection = (NavigationNodeGroupSection)base.GetParameter("GS");
            StoreObjectType            folderType;
            string            className;
            DefaultFolderType defaultFolderType;

            switch (navigationNodeGroupSection)
            {
            case NavigationNodeGroupSection.Calendar:
                folderType        = StoreObjectType.CalendarFolder;
                className         = "IPF.Appointment";
                defaultFolderType = DefaultFolderType.Calendar;
                break;

            case NavigationNodeGroupSection.Contacts:
                folderType        = StoreObjectType.ContactsFolder;
                className         = "IPF.Contact";
                defaultFolderType = DefaultFolderType.Contacts;
                break;

            case NavigationNodeGroupSection.Tasks:
                folderType        = StoreObjectType.TasksFolder;
                className         = "IPF.Task";
                defaultFolderType = DefaultFolderType.Tasks;
                break;

            default:
                throw new OwaInvalidRequestException("Invalid group section: " + navigationNodeGroupSection.ToString());
            }
            StoreObjectId            nodeId = (StoreObjectId)base.GetParameter("pid");
            NavigationNodeCollection navigationNodeCollection = NavigationNodeCollection.TryCreateNavigationNodeCollection(base.UserContext, base.UserContext.MailboxSession, navigationNodeGroupSection);
            int num = navigationNodeCollection.FindChildByNodeId(nodeId);

            if (num < 0)
            {
                throw new OwaEventHandlerException("The parent group doesn't exist.", LocalizedStrings.GetNonEncoded(-289549140), true);
            }
            using (Folder folder = Utilities.CreateSubFolder(Utilities.GetDefaultFolderId(base.UserContext, base.UserContext.MailboxSession, defaultFolderType), folderType, text, base.UserContext))
            {
                folder.ClassName = className;
                try
                {
                    folder.Save();
                }
                catch (ObjectExistedException)
                {
                    throw;
                }
                catch (StoragePermanentException innerException)
                {
                    throw new OwaAccessDeniedException(LocalizedStrings.GetNonEncoded(995407892), innerException);
                }
                folder.Load(FolderList.FolderTreeQueryProperties);
                StoreObjectId objectId = folder.Id.ObjectId;
                navigationNodeCollection.AddFolderToGroup(num, folder, base.UserContext, folder.DisplayName, NavigationNodeType.NormalFolder);
                navigationNodeCollection.Save(base.UserContext.MailboxSession);
                navigationNodeCollection = NavigationNodeCollection.TryCreateNavigationNodeCollection(base.UserContext, base.UserContext.MailboxSession, navigationNodeGroupSection);
                NavigationFolderTreeNode navigationFolderTreeNode  = new NavigationFolderTreeNode(base.UserContext, navigationNodeCollection.FindFoldersById(objectId)[0], folder);
                NavigationFolderTreeNode navigationFolderTreeNode2 = navigationFolderTreeNode;
                navigationFolderTreeNode2.CustomAttributes += " _NF=1";
                this.Writer.Write("<div id=ntn>");
                navigationFolderTreeNode.RenderUndecoratedNode(this.Writer);
                this.Writer.Write("</div>");
            }
        }
예제 #25
0
 private NavigationNodeCollection(UserContext userContext, MailboxSession session, NavigationNodeGroupSection navigationNodeGroupSection, object[][] data)
 {
     this.navigationNodeGroupSection = navigationNodeGroupSection;
     if (!this.IsFavorites)
     {
         this.ThrowIfNonMailGroupSectionNotSupported();
     }
     this.Load(userContext, session, data);
 }
예제 #26
0
        private static NavigationTree[] CreateNavigationTreeByFolderLists(UserContext userContext, FolderList[] folderLists, params NavigationNodeCollection[] collections)
        {
            if (folderLists == null || folderLists.Length == 0)
            {
                throw new ArgumentNullException("folderLists");
            }
            if (collections.Length == 0)
            {
                return(new NavigationTree[0]);
            }
            string[]        array  = new string[collections.Length];
            StoreObjectId[] array2 = new StoreObjectId[collections.Length];
            for (int i = 0; i < collections.Length; i++)
            {
                array[i] = NavigationNode.GetFolderClass(collections[i].GroupSection);
                if (ObjectClass.IsOfClass(array[i], "IPF.Note"))
                {
                    throw new ArgumentException("Invalid group section. Can only be Calendar, Contact, Task");
                }
                switch (collections[i].GroupSection)
                {
                case NavigationNodeGroupSection.Calendar:
                    array2[i] = Utilities.TryGetDefaultFolderId(userContext.MailboxSession, DefaultFolderType.Calendar);
                    break;

                case NavigationNodeGroupSection.Contacts:
                    array2[i] = Utilities.TryGetDefaultFolderId(userContext.MailboxSession, DefaultFolderType.Contacts);
                    break;

                case NavigationNodeGroupSection.Tasks:
                    array2[i] = Utilities.TryGetDefaultFolderId(userContext.MailboxSession, DefaultFolderType.Tasks);
                    break;

                default:
                    throw new ArgumentException("Invalid group section. Can only be Calendar, Contact, Task");
                }
            }
            Dictionary <string, StoreObjectId>[] array3 = new Dictionary <string, StoreObjectId> [collections.Length];
            for (int j = 0; j < array.Length; j++)
            {
                array3[j] = new Dictionary <string, StoreObjectId>();
            }
            foreach (FolderList folderList in folderLists)
            {
                foreach (StoreObjectId storeObjectId in folderList.GetFolderIds())
                {
                    string itemClass = folderList.GetFolderProperty(storeObjectId, StoreObjectSchema.ContainerClass) as string;
                    for (int m = 0; m < array.Length; m++)
                    {
                        if (ObjectClass.IsOfClass(itemClass, array[m]))
                        {
                            string key = folderList.MailboxSession.MailboxOwnerLegacyDN.ToLowerInvariant() + storeObjectId.ToString();
                            array3[m][key] = storeObjectId;
                            break;
                        }
                    }
                }
            }
            bool flag = false;

            NavigationNodeGroupSection[] array4 = new NavigationNodeGroupSection[collections.Length];
            StoreObjectId storeObjectId2        = userContext.TryGetMyDefaultFolderId(DefaultFolderType.ToDoSearch);
            List <NavigationNodeFolder> list    = new List <NavigationNodeFolder>();

            for (int n = 0; n < collections.Length; n++)
            {
                list.Clear();
                bool flag2 = false;
                bool flag3 = false;
                NavigationNodeCollection   navigationNodeCollection   = collections[n];
                NavigationNodeGroupSection navigationNodeGroupSection = navigationNodeCollection.GroupSection;
                array4[n] = navigationNodeGroupSection;
                foreach (NavigationNodeGroup navigationNodeGroup in navigationNodeCollection)
                {
                    foreach (NavigationNodeFolder navigationNodeFolder in navigationNodeGroup.Children)
                    {
                        if (navigationNodeFolder.IsValid && navigationNodeFolder.FolderId != null && !navigationNodeFolder.IsFlagSet(NavigationNodeFlags.PublicFolderFavorite))
                        {
                            bool flag4 = false;
                            foreach (FolderList folderList2 in folderLists)
                            {
                                if (navigationNodeFolder.IsFolderInSpecificMailboxSession(folderList2.MailboxSession))
                                {
                                    flag4 = true;
                                    break;
                                }
                            }
                            if (flag4)
                            {
                                string key2 = navigationNodeFolder.MailboxLegacyDN.ToLowerInvariant() + navigationNodeFolder.FolderId.ToString();
                                if (!array3[n].Remove(key2))
                                {
                                    if (navigationNodeGroupSection == NavigationNodeGroupSection.Tasks && storeObjectId2 != null && storeObjectId2.Equals(navigationNodeFolder.FolderId))
                                    {
                                        flag3 = true;
                                    }
                                    else
                                    {
                                        list.Add(navigationNodeFolder);
                                    }
                                }
                                if (navigationNodeFolder.FolderId.Equals(array2[n]))
                                {
                                    foreach (FolderList folderList3 in folderLists)
                                    {
                                        if (navigationNodeFolder.IsFolderInSpecificMailboxSession(folderList3.MailboxSession))
                                        {
                                            string text    = (string)folderList3.GetFolderProperty(navigationNodeFolder.FolderId, FolderSchema.DisplayName);
                                            string subject = navigationNodeFolder.Subject;
                                            if (text != null && !text.Equals(subject))
                                            {
                                                navigationNodeFolder.Subject = text;
                                                flag2 = true;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                if (navigationNodeGroupSection == NavigationNodeGroupSection.Tasks && !flag3 && storeObjectId2 != null)
                {
                    navigationNodeCollection.InsertToDoFolderToGroup(userContext);
                    flag2 = true;
                }
                if (array3[n].Count > 0)
                {
                    foreach (KeyValuePair <string, StoreObjectId> keyValuePair in array3[n])
                    {
                        StoreObjectId value = keyValuePair.Value;
                        string        key3  = keyValuePair.Key;
                        string        y     = key3.Substring(0, key3.LastIndexOf(value.ToString()));
                        foreach (FolderList folderList4 in folderLists)
                        {
                            if (StringComparer.OrdinalIgnoreCase.Equals(folderList4.MailboxSession.MailboxOwnerLegacyDN, y))
                            {
                                navigationNodeCollection.AddMyFolderToGroup(userContext, folderList4.MailboxSession, folderList4.GetFolderProperties(value), folderList4.QueryPropertyMap);
                                break;
                            }
                        }
                    }
                    flag2 = true;
                }
                if (list.Count > 0)
                {
                    foreach (NavigationNodeFolder navigationNodeFolder2 in list)
                    {
                        navigationNodeCollection.RemoveFolderOrGroupByNodeId(navigationNodeFolder2.NavigationNodeId.ObjectId);
                    }
                    flag2 = true;
                }
                if (flag2)
                {
                    navigationNodeCollection.Save(userContext.MailboxSession);
                    flag = true;
                }
            }
            if (flag)
            {
                collections = NavigationNodeCollection.TryCreateNavigationNodeCollections(userContext, userContext.MailboxSession, array4);
            }
            NavigationTree[] array5 = new NavigationTree[collections.Length];
            for (int num4 = 0; num4 < collections.Length; num4++)
            {
                NavigationNodeCollection navigationNodeCollection2 = collections[num4];
                NavigationTree           navigationTree            = new NavigationTree(userContext, new InvisibleRootTreeNode(userContext), navigationNodeCollection2.GroupSection);
                foreach (NavigationNodeGroup navigationNodeGroup2 in navigationNodeCollection2)
                {
                    if (!navigationNodeGroup2.IsNew)
                    {
                        if ((navigationNodeCollection2.GroupSection == NavigationNodeGroupSection.Contacts || navigationNodeCollection2.GroupSection == NavigationNodeGroupSection.Tasks) && NavigationNodeCollection.PeoplesFoldersClassId.Equals(navigationNodeGroup2.NavigationNodeGroupClassId))
                        {
                            bool flag5 = false;
                            foreach (NavigationNodeFolder navigationNodeFolder3 in navigationNodeGroup2.Children)
                            {
                                if (navigationNodeFolder3.NavigationNodeType != NavigationNodeType.SharedFolder)
                                {
                                    flag5 = true;
                                    break;
                                }
                            }
                            if (!flag5)
                            {
                                continue;
                            }
                        }
                        NavigationGroupHeaderTreeNode navigationGroupHeaderTreeNode = new NavigationGroupHeaderTreeNode(userContext, navigationNodeGroup2);
                        foreach (NavigationNodeFolder navigationNodeFolder4 in navigationNodeGroup2.Children)
                        {
                            if (((navigationNodeCollection2.GroupSection != NavigationNodeGroupSection.Contacts && navigationNodeCollection2.GroupSection != NavigationNodeGroupSection.Tasks) || navigationNodeFolder4.NavigationNodeType != NavigationNodeType.SharedFolder) && navigationNodeFolder4.IsValid && (navigationNodeFolder4.IsGSCalendar || navigationNodeFolder4.FolderId != null))
                            {
                                NavigationFolderTreeNode navigationFolderTreeNode = null;
                                foreach (FolderList folderList5 in folderLists)
                                {
                                    object[] array6 = null;
                                    if (navigationNodeFolder4.FolderId != null)
                                    {
                                        array6 = folderList5.GetFolderProperties(navigationNodeFolder4.FolderId);
                                    }
                                    if (array6 != null)
                                    {
                                        navigationFolderTreeNode = new NavigationFolderTreeNode(userContext, navigationNodeFolder4, null, array6, folderList5.QueryPropertyMap);
                                        break;
                                    }
                                }
                                if (navigationFolderTreeNode == null && (!navigationNodeFolder4.IsFolderInSpecificMailboxSession(userContext.MailboxSession) || (navigationNodeFolder4.FolderId != null && Utilities.IsDefaultFolderId(userContext.MailboxSession, navigationNodeFolder4.FolderId, DefaultFolderType.ToDoSearch))))
                                {
                                    navigationFolderTreeNode = new NavigationFolderTreeNode(userContext, navigationNodeFolder4);
                                }
                                if (navigationFolderTreeNode != null)
                                {
                                    navigationGroupHeaderTreeNode.AddChild(navigationFolderTreeNode);
                                }
                            }
                        }
                        navigationTree.RootNode.AddChild(navigationGroupHeaderTreeNode);
                    }
                }
                array5[num4] = navigationTree;
            }
            return(array5);
        }
예제 #27
0
        internal NavigationNodeFolder(MailboxSession session, bool isMyMailbox, object[] folderPropertyValues, Dictionary <PropertyDefinition, int> folderPropertyMap, string subject, Guid groupClassId, NavigationNodeGroupSection navigationNodeGroupSection, string groupName) : base(NavigationNodeType.NormalFolder, subject, navigationNodeGroupSection)
        {
            if (session == null)
            {
                throw new ArgumentNullException("session");
            }
            Utilities.CheckAndThrowForRequiredProperty(folderPropertyMap, new PropertyDefinition[]
            {
                FolderSchema.Id,
                StoreObjectSchema.RecordKey,
                FolderSchema.ExtendedFolderFlags
            });
            StoreObjectId       objectId = ((VersionedId)folderPropertyValues[folderPropertyMap[FolderSchema.Id]]).ObjectId;
            ExtendedFolderFlags flags    = (ExtendedFolderFlags)0;
            object obj = folderPropertyValues[folderPropertyMap[FolderSchema.ExtendedFolderFlags]];

            if (!(obj is PropertyError))
            {
                flags = (ExtendedFolderFlags)obj;
            }
            this.Initialize(session, isMyMailbox, objectId, folderPropertyValues[folderPropertyMap[StoreObjectSchema.RecordKey]], flags, groupClassId, groupName);
            base.ClearDirty();
        }
예제 #28
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"));
        }
예제 #29
0
        internal static void AddNonMailFolderToSharedFoldersGroup(UserContext userContext, Folder folder, NavigationNodeGroupSection groupSection)
        {
            if (groupSection == NavigationNodeGroupSection.Mail)
            {
                throw new ArgumentOutOfRangeException("Cannot add mail folder to shared folder group");
            }
            NavigationNodeCollection navigationNodeCollection = NavigationNodeCollection.TryCreateNavigationNodeCollection(userContext, userContext.MailboxSession, groupSection);

            if (navigationNodeCollection.FindFoldersById(folder.Id.ObjectId).Length == 0)
            {
                navigationNodeCollection.AddFolderToDefaultGroup(userContext, NavigationNodeGroupType.SharedFoldersGroup, folder, true);
                navigationNodeCollection.Save(userContext.MailboxSession);
            }
        }
예제 #30
0
        public static NavigationTree[] CreateFavoriteAndNavigationTrees(UserContext userContext, params NavigationNodeGroupSection[] groupSections)
        {
            bool includeSearchFolder = false;

            NavigationTree[]         array = new NavigationTree[groupSections.Length];
            NavigationNodeCollection navigationCollection = null;

            for (int i = 0; i < groupSections.Length; i++)
            {
                if (groupSections[i] == NavigationNodeGroupSection.First)
                {
                    includeSearchFolder = true;
                }
            }
            NavigationTree.NormalAndSearchFolderList   item;
            NavigationTree.NormalAndSearchFolderList[] array2;
            NavigationTree.CreateNormalAndSearchFolderLists(userContext, false, includeSearchFolder, out item, out array2);
            NavigationNodeCollection[]      array3 = NavigationNodeCollection.TryCreateNavigationNodeCollections(userContext, userContext.MailboxSession, groupSections);
            List <NavigationNodeCollection> list   = new List <NavigationNodeCollection>();

            for (int j = 0; j < array3.Length; j++)
            {
                NavigationNodeGroupSection navigationNodeGroupSection = array3[j].GroupSection;
                if (navigationNodeGroupSection != NavigationNodeGroupSection.First)
                {
                    if ((navigationNodeGroupSection == NavigationNodeGroupSection.Calendar && userContext.IsFeatureEnabled(Feature.Calendar)) || (navigationNodeGroupSection == NavigationNodeGroupSection.Contacts && userContext.IsFeatureEnabled(Feature.Contacts)) || (navigationNodeGroupSection == NavigationNodeGroupSection.Tasks && userContext.IsFeatureEnabled(Feature.Tasks)))
                    {
                        list.Add(array3[j]);
                    }
                }
                else
                {
                    navigationCollection = array3[j];
                }
            }
            List <NavigationTree.NormalAndSearchFolderList> list2 = new List <NavigationTree.NormalAndSearchFolderList>(1 + array2.Length);

            list2.Add(item);
            list2.AddRange(array2);
            List <FolderList> list3 = new List <FolderList>();

            foreach (NavigationTree.NormalAndSearchFolderList normalAndSearchFolderList in list2)
            {
                list3.Add(normalAndSearchFolderList.DeepHierarchyFolderList);
            }
            NavigationTree[] array4 = NavigationTree.CreateNavigationTreeByFolderLists(userContext, list3.ToArray(), list.ToArray());
            for (int k = 0; k < groupSections.Length; k++)
            {
                if (groupSections[k] == NavigationNodeGroupSection.First)
                {
                    array[k] = NavigationTree.CreateFavoriteTreeByFolderLists(userContext, navigationCollection, list2.ToArray());
                }
                else
                {
                    array[k] = null;
                    for (int l = 0; l < array4.Length; l++)
                    {
                        if (array4[l].groupSection == groupSections[k])
                        {
                            array[k] = array4[l];
                            break;
                        }
                    }
                }
            }
            return(array);
        }