示例#1
0
        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);
        }