public static NavigationNodeCollection TryCreateNavigationNodeCollection(UserContext userContext, MailboxSession session, NavigationNodeGroupSection navigationNodeGroupSection) { return(NavigationNodeCollection.TryCreateNavigationNodeCollections(userContext, session, new NavigationNodeGroupSection[] { navigationNodeGroupSection })[0]); }
public static NavigationNodeCollection[] TryCreateNavigationNodeCollections(UserContext userContext, MailboxSession session, params NavigationNodeGroupSection[] groupSections) { bool flag = false; List <NavigationNodeCollection> list = null; list = NavigationNodeCollection.LoadNavigationNodeCollection(userContext, session, groupSections); foreach (NavigationNodeCollection navigationNodeCollection in list) { if (navigationNodeCollection.CheckIfDataCorrected()) { flag = true; navigationNodeCollection.Save(session); } } if (flag) { list = NavigationNodeCollection.LoadNavigationNodeCollection(userContext, session, groupSections); foreach (NavigationNodeCollection navigationNodeCollection2 in list) { if (navigationNodeCollection2.CheckIfDataCorrected()) { ExTraceGlobals.CoreCallTracer.TraceDebug <NavigationNodeGroupSection>(0L, "Retry twice but read invalid format data for group {0} from mailbox session.", navigationNodeCollection2.GroupSection); } } } return(list.ToArray()); }
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)); }
// Token: 0x0600078A RID: 1930 RVA: 0x00039620 File Offset: 0x00037820 public static int GetCalendarFolderColor(UserContext userContext, StoreObjectId calendarFolderId) { CalendarColorManager.ThrowIfCannotActAsOwner(userContext); NavigationNodeCollection navigationNodeCollection = NavigationNodeCollection.TryCreateNavigationNodeCollection(userContext, userContext.MailboxSession, NavigationNodeGroupSection.Calendar); return(CalendarColorManager.GetCalendarFolderColor(userContext, calendarFolderId, navigationNodeCollection)); }
public static NavigationNodeGroup CreateCustomizedGroup(NavigationNodeGroupSection groupSection, string groupSubject) { if (groupSubject == null) { throw new ArgumentNullException("groupSubject"); } return(NavigationNodeCollection.CreateCustomizedGroup(groupSection, groupSubject, Guid.NewGuid())); }
private static List <NavigationNodeCollection> LoadNavigationNodeCollection(UserContext userContext, MailboxSession session, params NavigationNodeGroupSection[] groupSections) { object[][] data = NavigationNodeCollection.LoadCommonViewAssociatedMessages(session); List <NavigationNodeCollection> list = new List <NavigationNodeCollection>(groupSections.Length); foreach (NavigationNodeGroupSection navigationNodeGroupSection in groupSections) { list.Add(new NavigationNodeCollection(userContext, session, navigationNodeGroupSection, data)); } return(list); }
internal static void AddGSCalendarToSharedFoldersGroup(UserContext userContext, ExchangePrincipal exchangePrincipal) { NavigationNodeCollection navigationNodeCollection = NavigationNodeCollection.TryCreateNavigationNodeCollection(userContext, userContext.MailboxSession, NavigationNodeGroupSection.Calendar); if (navigationNodeCollection.FindGSCalendarsByLegacyDN(exchangePrincipal.LegacyDn).Length == 0) { int defaultGroup = navigationNodeCollection.GetDefaultGroup(NavigationNodeGroupType.SharedFoldersGroup); NavigationNodeGroup navigationNodeGroup = navigationNodeCollection[defaultGroup]; NavigationNodeFolder node = NavigationNodeFolder.CreateGSNode(exchangePrincipal, navigationNodeGroup.NavigationNodeGroupClassId, navigationNodeGroup.Subject, exchangePrincipal.MailboxInfo.DisplayName, navigationNodeGroup.NavigationNodeGroupSection); navigationNodeGroup.Children.Insert(navigationNodeGroup.Children.Count, node); navigationNodeCollection.Save(userContext.MailboxSession); } }
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); } }
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)); }
// Token: 0x0600078C RID: 1932 RVA: 0x00039720 File Offset: 0x00037920 public static int GetCalendarFolderColor(UserContext userContext, NavigationNodeCollection navigationNodeCollection, NavigationNodeFolder[] navigationNodeFolders) { CalendarColorManager.ThrowIfCannotActAsOwner(userContext); int num = -2; if (navigationNodeFolders != null && navigationNodeFolders.Length > 0) { num = navigationNodeFolders[0].NavigationNodeCalendarColor; } if (!CalendarColorManager.IsColorIndexValid(num)) { num = -2; foreach (NavigationNodeFolder navigationNodeFolder in navigationNodeFolders) { navigationNodeFolder.NavigationNodeCalendarColor = num; } navigationNodeCollection.Save(userContext.MailboxSession); } return(num); }
private int GetDefaultGroup(NavigationNodeGroupType groupType) { int num = this.FindGroupById(NavigationNodeCollection.GetDefaultGroupClassId(groupType)); if (num < 0) { NavigationNodeGroup node = NavigationNodeCollection.CreateDefaultGroup(groupType, this.navigationNodeGroupSection); num = 0; if (groupType == NavigationNodeGroupType.SharedFoldersGroup) { num = this.FindGroupById(NavigationNodeCollection.GetDefaultGroupClassId(NavigationNodeGroupType.MyFoldersGroup)) + 1; } else if (groupType == NavigationNodeGroupType.OtherFoldersGroup) { int val = this.FindGroupById(NavigationNodeCollection.GetDefaultGroupClassId(NavigationNodeGroupType.MyFoldersGroup)); int val2 = this.FindGroupById(NavigationNodeCollection.GetDefaultGroupClassId(NavigationNodeGroupType.SharedFoldersGroup)); num = Math.Max(val, val2) + 1; } base.Insert(num, node); } return(num); }
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); }
private void Load(UserContext userContext, MailboxSession session, object[][] rows) { int num = 0; while (num < rows.Length && !NavigationNodeCollection.CheckItemClassAndSection(this.navigationNodeGroupSection, rows[num])) { num++; } if (this.IsFavorites) { base.Clear(); base.Add(NavigationNodeCollection.CreateFavoritesGroup()); } else { int num2 = num; while (num2 < rows.Length && NavigationNodeCollection.CheckItemClassAndSection(this.navigationNodeGroupSection, rows[num2])) { if (NavigationNodeCollection.CheckNodeTypes(rows[num2], new NavigationNodeType[] { NavigationNodeType.Header })) { this.UniquelyAddGroup(new NavigationNodeGroup(rows[num2], NavigationNodeCollection.PropertyMap)); } num2++; } } Dictionary <Guid, int> dictionary = new Dictionary <Guid, int>(base.Count); for (int i = 0; i < base.Count; i++) { dictionary.Add(base[i].NavigationNodeGroupClassId, i); } while (num < rows.Length && NavigationNodeCollection.CheckItemClassAndSection(this.navigationNodeGroupSection, rows[num])) { if (NavigationNodeCollection.CheckNodeTypes(rows[num], new NavigationNodeType[] { NavigationNodeType.NormalFolder, NavigationNodeType.SharedFolder, NavigationNodeType.SmartFolder, NavigationNodeType.GSCalendar })) { bool includeArchive = this.GroupSection == NavigationNodeGroupSection.First; NavigationNodeFolder navigationNodeFolder = new NavigationNodeFolder(userContext, session, includeArchive, rows[num], NavigationNodeCollection.PropertyMap); if (navigationNodeFolder.IsValid) { int num3 = -1; if (this.IsFavorites) { num3 = 0; } else { Guid guid = navigationNodeFolder.NavigationNodeParentGroupClassId; if (!guid.Equals(Guid.Empty) && dictionary.ContainsKey(guid)) { num3 = dictionary[guid]; } else { NavigationNodeGroup node = null; if (!guid.Equals(Guid.Empty) && !string.IsNullOrEmpty(navigationNodeFolder.NavigationNodeGroupName)) { node = NavigationNodeCollection.CreateCustomizedGroup(this.navigationNodeGroupSection, navigationNodeFolder.NavigationNodeGroupName, guid); } else { NavigationNodeGroupType navigationNodeGroupType = NavigationNodeGroupType.OtherFoldersGroup; switch (navigationNodeFolder.NavigationNodeType) { case NavigationNodeType.NormalFolder: navigationNodeGroupType = NavigationNodeGroupType.MyFoldersGroup; break; case NavigationNodeType.SharedFolder: navigationNodeGroupType = NavigationNodeGroupType.SharedFoldersGroup; break; } guid = NavigationNodeCollection.GetDefaultGroupClassId(navigationNodeGroupType); if (dictionary.ContainsKey(guid)) { num3 = dictionary[guid]; } else { node = NavigationNodeCollection.CreateDefaultGroup(navigationNodeGroupType, this.navigationNodeGroupSection); } } if (num3 < 0) { base.Add(node); num3 = base.Count - 1; dictionary[guid] = num3; } } } this.UniquelyAddFolder(navigationNodeFolder, num3); } } num++; } this.serverCollection = new NavigationNodeList <NavigationNodeGroup>(); base.CopyToList(this.serverCollection); foreach (NavigationNodeGroup navigationNodeGroup in this) { foreach (NavigationNodeFolder navigationNodeFolder2 in navigationNodeGroup.Children) { if (navigationNodeFolder2.FolderId != null && !navigationNodeFolder2.IsFlagSet(NavigationNodeFlags.PublicFolderFavorite)) { navigationNodeFolder2.FixLegacyDNRelatedFlag(session); } } } }
private static NavigationNodeGroup CreateFavoritesGroup() { return(new NavigationNodeGroup(NavigationNodeCollection.GetDefaultGroupSubject(NavigationNodeGroupType.MyFoldersGroup, NavigationNodeGroupSection.First), NavigationNodeGroupSection.First, Guid.NewGuid())); }
private static NavigationNodeGroup CreateDefaultGroup(NavigationNodeGroupType groupType, NavigationNodeGroupSection groupSection) { return(new NavigationNodeGroup(NavigationNodeCollection.GetDefaultGroupSubject(groupType, groupSection), groupSection, NavigationNodeCollection.GetDefaultGroupClassId(groupType))); }
// Token: 0x0600078B RID: 1931 RVA: 0x0003964C File Offset: 0x0003784C public static int GetCalendarFolderColor(UserContext userContext, StoreObjectId calendarFolderId, NavigationNodeCollection navigationNodeCollection) { CalendarColorManager.ThrowIfCannotActAsOwner(userContext); if (userContext == null) { throw new ArgumentNullException("userContext"); } if (calendarFolderId == null) { throw new ArgumentNullException("calendarFolderId"); } int result = -2; if (navigationNodeCollection != null) { try { NavigationNodeFolder[] navigationNodeFolders = navigationNodeCollection.FindFoldersById(calendarFolderId); result = CalendarColorManager.GetCalendarFolderColor(userContext, navigationNodeCollection, navigationNodeFolders); } catch (StoragePermanentException ex) { string message = string.Format(CultureInfo.InvariantCulture, "CalendarColorManager.GetCalendarFolderColor. Unable to get calendar folder color. Exception: {0}.", new object[] { ex.Message }); ExTraceGlobals.CoreCallTracer.TraceDebug(0L, message); } catch (StorageTransientException ex2) { string message2 = string.Format(CultureInfo.InvariantCulture, "CalendarColorManager.GetCalendarFolderColor. Unable to get calendar folder color. Exception: {0}.", new object[] { ex2.Message }); ExTraceGlobals.CoreCallTracer.TraceDebug(0L, message2); } } return(result); }