public static TaskGroupInfoList GetTaskGroupsView(MailboxSession session) { bool flag = false; bool flag2 = true; Dictionary <Guid, TaskGroupInfo> guidToGroupMapping = new Dictionary <Guid, TaskGroupInfo>(); Dictionary <StoreObjectId, TaskGroupEntryInfo> dictionary = new Dictionary <StoreObjectId, TaskGroupEntryInfo>(); List <FolderTreeDataInfo> duplicateNodes = new List <FolderTreeDataInfo>(); Dictionary <TaskGroupType, TaskGroupInfo> defaultGroups = new Dictionary <TaskGroupType, TaskGroupInfo>(); TaskGroupInfoList taskGroupInfoList = new TaskGroupInfoList(duplicateNodes, defaultGroups, dictionary); using (Folder folder = Folder.Bind(session, DefaultFolderType.CommonViews)) { using (QueryResult queryResult = folder.ItemQuery(ItemQueryType.Associated, null, TaskGroup.TaskGroupViewSortOrder, TaskGroup.TaskInfoProperties)) { queryResult.SeekToCondition(SeekReference.OriginBeginning, TaskGroup.TaskSectionFilter); while (flag2) { IStorePropertyBag[] propertyBags = queryResult.GetPropertyBags(10000); if (propertyBags.Length == 0) { break; } foreach (IStorePropertyBag storePropertyBag in propertyBags) { if (!TaskGroup.IsTaskSection(storePropertyBag)) { flag2 = false; break; } if (TaskGroup.IsFolderTreeData(storePropertyBag)) { if (TaskGroup.IsTaskGroup(storePropertyBag)) { if (flag) { ExTraceGlobals.StorageTracer.TraceDebug <VersionedId, string>(0L, "Unexpected processing task group out of order. ItemId: {0}, Subject: {1}", (VersionedId)storePropertyBag.TryGetProperty(ItemSchema.Id), storePropertyBag.GetValueOrDefault <string>(ItemSchema.Subject, string.Empty)); } else { TaskGroup.AddGroupToList(storePropertyBag, guidToGroupMapping, taskGroupInfoList); } } else if (TaskGroup.IsTaskGroupEntry(storePropertyBag)) { flag = true; TaskGroup.AddTaskFolderToList(storePropertyBag, guidToGroupMapping, dictionary, taskGroupInfoList); } } } } } } return(taskGroupInfoList); }
private void LoadChildNodesCollection(IStorePropertyBag[] rows, int startIndex) { for (int i = startIndex; i < rows.Length; i++) { IStorePropertyBag storePropertyBag = rows[i]; if (TaskGroup.IsTaskSection(storePropertyBag) && TaskGroup.IsFolderTreeData(storePropertyBag) && TaskGroup.IsTaskGroupEntry(storePropertyBag)) { byte[] valueOrDefault = storePropertyBag.GetValueOrDefault <byte[]>(FolderTreeDataSchema.ParentGroupClassId, null); if (valueOrDefault == null || valueOrDefault.Length != 16) { ExTraceGlobals.StorageTracer.TraceDebug <int>(0L, "Found TaskGroupEntry with invalid parent group id. ArrayLength: {0}", (valueOrDefault == null) ? -1 : valueOrDefault.Length); } else { Guid g = new Guid(valueOrDefault); if (this.groupClassId.Equals(g)) { TaskGroupEntryInfo taskGroupEntryInfoFromRow = TaskGroupEntry.GetTaskGroupEntryInfoFromRow(storePropertyBag); if (taskGroupEntryInfoFromRow != null) { this.children.Add(taskGroupEntryInfoFromRow); } } } } } this.hasLoadedTaskFoldersCollection = true; }
internal static bool IsTaskFolderInGroup(IStorePropertyBag row, Guid groupClassId) { byte[] valueOrDefault = row.GetValueOrDefault <byte[]>(FolderTreeDataSchema.ParentGroupClassId, null); return(TaskGroup.IsTaskGroupEntry(row) && Util.CompareByteArray(groupClassId.ToByteArray(), valueOrDefault)); }