Ejemplo n.º 1
0
        private async Task <List <O365Task> > GetO365TasksAsync(GraphServiceClient graphService, Plan plan)
        {
            var tasks = await PlanService.GetTasksAsync(plan);

            var result = new List <O365Task>();

            foreach (var item in tasks)
            {
                var task = new O365Task
                {
                    Title        = item.title,
                    AssignedTo   = !string.IsNullOrEmpty(item.assignedTo) ? (await graphService.Users[item.assignedTo].Request().GetAsync()).DisplayName : "",
                    AssignedBy   = !string.IsNullOrEmpty(item.assignedBy) ? (await graphService.Users[item.assignedBy].Request().GetAsync()).DisplayName : "",
                    AssignedDate = item.assignedDateTime.HasValue ? item.assignedDateTime.Value.DateTime.ToLocalTime().ToString() : ""
                };
                result.Add(task);
            }
            return(result);
        }
        private async Task<List<O365Task>> GetO365TasksAsync(GraphServiceClient graphService, Plan plan)
        {
            var tasks = await PlanService.GetTasksAsync(plan);

            var result = new List<O365Task>();

            foreach (var item in tasks)
            {
                var task = new O365Task
                {
                    Title = item.title,
                    AssignedTo = !string.IsNullOrEmpty(item.assignedTo) ? (await graphService.Users[item.assignedTo].Request().GetAsync()).DisplayName : "",
                    AssignedBy = !string.IsNullOrEmpty(item.assignedBy) ? (await graphService.Users[item.assignedBy].Request().GetAsync()).DisplayName : "",
                    AssignedDate = item.assignedDateTime.HasValue ? item.assignedDateTime.Value.DateTime.ToLocalTime().ToString() : ""
                };
                result.Add(task);
            }
            return result;
        }