Esempio n. 1
0
        public NavigationNodeFolder AddFolderToDefaultGroup(UserContext userContext, NavigationNodeGroupType groupType, Folder folder, bool isSharedFolder)
        {
            this.ThrowIfSaved();
            if (!NavigationNodeCollection.IsDefaultGroupType(groupType))
            {
                throw new ArgumentOutOfRangeException("Invalid default group type:" + groupType.ToString());
            }
            this.ThrowIfNonMailGroupSectionNotSupported();
            NavigationNodeCollection.ThrowIfGroupSectionNotMatchFolderClass(this.navigationNodeGroupSection, folder.ClassName);
            MailboxSession mailboxSession = folder.Session as MailboxSession;

            if (mailboxSession == null)
            {
                throw new ArgumentException("Should not add a folder that doesn't belong to a mailbox session.");
            }
            string text;

            if (isSharedFolder)
            {
                text = Utilities.GetMailboxOwnerDisplayName(mailboxSession);
                if (!Utilities.IsSpecialFolderForSession(mailboxSession, folder.Id.ObjectId))
                {
                    text = string.Format(LocalizedStrings.GetNonEncoded(-83764036), text, folder.DisplayName);
                }
            }
            else
            {
                text = folder.DisplayName;
            }
            return(this.AddFolderToGroup(this.GetDefaultGroup(groupType), folder, userContext, text, isSharedFolder ? NavigationNodeType.SharedFolder : NavigationNodeType.NormalFolder));
        }