Esempio n. 1
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);
            }
        }