예제 #1
0
        public async Task <Idea[]> GetAsync(Team team, string planId, string status, DateTime?from)
        {
            var bucketName = GetBucketName(status);
            var buckets    = await plannerService.GetBucketsAsync(planId);

            var bucketDict = buckets.ToDictionary(b => b.Id);
            var bucket     = buckets.FirstOrDefault(i => i.Name == bucketName);

            var members = await teamService.GetTeamMembersAsync(team.Id);

            var membersDict = members.ToDictionary(m => m.Id);

            var tasks = await graphServiceClient.Planner.Plans[planId].Tasks.Request().GetAllAsync();

            if (bucket != null)
            {
                tasks = tasks.Where(i => i.BucketId == bucket.Id).ToArray();
            }

            return(tasks.Select(i => new Idea
            {
                Id = i.Id,
                Bucket = bucketDict[i.BucketId].Name,
                Title = i.Title,
                StartDate = i.StartDateTime,
                Owners = i.Assignments
                         .Select(a => membersDict[a.Key])
                         .ToArray()
            }).ToArray());
        }
예제 #2
0
        public async Task <Idea[]> GetAsync(Team team, string planId, string status, DateTime?from)
        {
            var bucketName = GetBucketName(status);
            var buckets    = await plannerService.GetBucketsAsync(planId);

            var bucketDict = buckets.ToDictionary(b => b.Id);
            var bucket     = buckets.FirstOrDefault(i => i.Name == bucketName);

            var members = await teamService.GetTeamMembersAsync(team.Id);

            var membersDict = members.ToDictionary(m => m.Id);

            //await plannerService.GetNewIdeaBucketAsync(plan);

            var tasks = await graphServiceClient.Planner.Plans[planId].Tasks.Request().GetAllAsync();

            // No HTTP resource was found that matches the request URI 'https://tasks.office.com:444/taskapi/v2.0/plans('NST-vWZbOUa-rQAZ6Fp8ymQADbhi')/buckets('CvDR5JNrfkOHYzsG7KWDI2QAENg7')/tasks
            // await graphServiceClient.Planner.Plans[planId].Buckets[bucket.Id].Tasks.Request().GetAllAsync();

            if (bucket != null)
            {
                tasks = tasks.Where(i => i.BucketId == bucket.Id).ToArray();
            }

            return(tasks.Select(i => new Idea
            {
                Id = i.Id,
                Bucket = bucketDict[i.BucketId].Name,
                Title = i.Title,
                StartDate = i.StartDateTime,
                Owners = i.Assignments
                         .Select(a => membersDict[a.Key])
                         .ToArray()
            }).ToArray());
        }