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));
        }
Esempio n. 2
0
        public NavigationNodeFolder InsertMyFolderToFavorites(Folder folder, int index)
        {
            this.ThrowIfSaved();
            if (!this.IsFavorites)
            {
                throw new InvalidOperationException("This collection doesn't represent favorites.");
            }
            NavigationNodeCollection.ThrowIfGroupSectionNotMatchFolderClass(this.navigationNodeGroupSection, folder.ClassName);
            if (base.Count == 0)
            {
                base.Add(NavigationNodeCollection.CreateFavoritesGroup());
            }
            StoreObjectType    objectType = folder.Id.ObjectId.ObjectType;
            NavigationNodeType nodeType   = (objectType == StoreObjectType.OutlookSearchFolder || objectType == StoreObjectType.SearchFolder) ? NavigationNodeType.SmartFolder : NavigationNodeType.NormalFolder;

            return(this.AddFolderToGroup(0, index, folder, !Utilities.IsInArchiveMailbox(folder), folder.DisplayName, nodeType));
        }
Esempio n. 3
0
        internal NavigationNodeFolder AddMyFolderToGroup(UserContext userContext, MailboxSession mailboxSession, object[] folderPropertyValues, Dictionary <PropertyDefinition, int> folderPropertyMap)
        {
            this.ThrowIfSaved();
            this.ThrowIfNonMailGroupSectionNotSupported();
            Utilities.CheckAndThrowForRequiredProperty(folderPropertyMap, new PropertyDefinition[]
            {
                FolderSchema.Id,
                FolderSchema.DisplayName,
                StoreObjectSchema.ContainerClass,
                FolderSchema.ExtendedFolderFlags
            });
            NavigationNodeCollection.ThrowIfGroupSectionNotMatchFolderClass(this.navigationNodeGroupSection, folderPropertyValues[folderPropertyMap[StoreObjectSchema.ContainerClass]] as string);
            bool flag = Utilities.IsOneOfTheFolderFlagsSet(folderPropertyValues[folderPropertyMap[FolderSchema.ExtendedFolderFlags]], new ExtendedFolderFlags[]
            {
                ExtendedFolderFlags.SharedIn,
                ExtendedFolderFlags.ExchangeCrossOrgShareFolder
            });
            bool flag2 = Utilities.IsOneOfTheFolderFlagsSet(folderPropertyValues[folderPropertyMap[FolderSchema.ExtendedFolderFlags]], new ExtendedFolderFlags[]
            {
                ExtendedFolderFlags.WebCalFolder
            });
            NavigationNodeGroupType groupType = NavigationNodeGroupType.MyFoldersGroup;

            if (flag2)
            {
                groupType = NavigationNodeGroupType.OtherFoldersGroup;
            }
            else if (flag)
            {
                groupType = NavigationNodeGroupType.SharedFoldersGroup;
            }
            int defaultGroup = this.GetDefaultGroup(groupType);
            NavigationNodeFolder navigationNodeFolder = new NavigationNodeFolder(mailboxSession, userContext.IsMyMailbox(mailboxSession), folderPropertyValues, folderPropertyMap, (folderPropertyValues[folderPropertyMap[FolderSchema.DisplayName]] as string) ?? string.Empty, base[defaultGroup].NavigationNodeGroupClassId, this.navigationNodeGroupSection, base[defaultGroup].Subject);

            base[defaultGroup].Children.Add(navigationNodeFolder);
            return(navigationNodeFolder);
        }