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; }
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)); }
private static bool CheckNodeTypes(object[] row, params NavigationNodeType[] types) { object obj = row[NavigationNodeCollection.PropertyMap[NavigationNodeSchema.Type]]; if (!(obj is int)) { return(false); } NavigationNodeType navigationNodeType = (NavigationNodeType)obj; foreach (NavigationNodeType navigationNodeType2 in types) { if (navigationNodeType == navigationNodeType2) { return(true); } } return(false); }
private NavigationNodeFolder AddFolderToGroup(int groupIndex, int nodeIndex, Folder folder, bool isMyFolder, string subject, NavigationNodeType nodeType) { NavigationNodeFolder navigationNodeFolder = new NavigationNodeFolder(folder, isMyFolder, subject, nodeType, base[groupIndex].NavigationNodeGroupClassId, this.navigationNodeGroupSection, base[groupIndex].Subject); NavigationNodeGroup navigationNodeGroup = base[groupIndex]; navigationNodeGroup.Children.Insert(nodeIndex, navigationNodeFolder); return(navigationNodeFolder); }
private NavigationNodeFolder AddFolderToGroup(int groupIndex, int nodeIndex, Folder folder, UserContext userContext, string subject, NavigationNodeType nodeType) { return(this.AddFolderToGroup(groupIndex, nodeIndex, folder, userContext.IsMyMailbox(folder.Session), subject, nodeType)); }
public NavigationNodeFolder AddFolderToGroup(int groupIndex, Folder folder, UserContext userContext, string subject, NavigationNodeType nodeType) { return(this.AddFolderToGroup(groupIndex, base[groupIndex].Children.Count, folder, userContext.IsMyMailbox(folder.Session), subject, nodeType)); }
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(); }
public static void AddNavigationLink(Web web, NavigationNodeType nodeType, string title, string url, bool asLast, string header, string previous, ClientContext clientContext) { var nodes = (nodeType == NavigationNodeType.QuickLaunch) ? web.Navigation.QuickLaunch : web.Navigation.TopNavigationBar; clientContext.Load(nodes, n => n.IncludeWithDefaultProperties(c => c.Children)); clientContext.ExecuteQuery(); if (header != null) { var headerNode = nodes.Where(x => x.Title == header).FirstOrDefault(); if (headerNode != null) { NavigationNodeCreationInformation ciNode = new NavigationNodeCreationInformation(); if (previous != null) { var children = headerNode.Children; clientContext.Load(children, n => n.IncludeWithDefaultProperties(c => c.Title)); var previousNode = children.Where(x => x.Title == previous).FirstOrDefault(); if (previousNode != null) { ciNode.PreviousNode = previousNode; } else { throw new Exception("Previous Node with title " + previous + " not found."); } } ciNode.AsLastNode = asLast; ciNode.Title = title; ciNode.Url = url; NavigationNode node = headerNode.Children.Add(ciNode); clientContext.ExecuteQuery(); } else { throw new Exception("Header Node with title " + header + " not found"); } } else { NavigationNodeCreationInformation ciNode = new NavigationNodeCreationInformation(); ciNode.AsLastNode = asLast; ciNode.Title = title; ciNode.Url = url; NavigationNode node = nodes.Add(ciNode); clientContext.ExecuteQuery(); } }