public async Task <Beta.PlannerTask> CreatePlannerTaskInBucketForAllAsync(string planId, string bucketId, string subject, string dueDate, string startTime, List <TeamsChannelAccount> members)
        {
            try
            {
                var graphClient = GetAuthenticatedClient();

                var assignments = new Beta.PlannerAssignments();
                foreach (var member in members)
                {
                    assignments.AddAssignee(member.AadObjectId);
                }
                var plannerTask = new Beta.PlannerTask
                {
                    DueDateTime   = DateTimeOffset.Parse(dueDate),
                    StartDateTime = DateTimeOffset.Parse(startTime),
                    Title         = subject,
                    PlanId        = planId,
                    Assignments   = assignments,
                    BucketId      = bucketId,
                };
                var plans = await graphClient.Planner.Tasks.Request().AddAsync(plannerTask).ConfigureAwait(false);

                return(plans);
            }
            catch (Exception ex)
            { throw ex; }
        }
Пример #2
0
        public async Task <Beta.PlannerTask> CreatePlannerTaskAsync(string planId, string subject, string dueDate, string startTime, string userId)
        {
            var graphClient = GetAuthenticatedClient();
            var assignments = new Beta.PlannerAssignments();

            assignments.AddAssignee(userId);
            var plannerTask = new Beta.PlannerTask
            {
                DueDateTime   = DateTimeOffset.Parse(dueDate),
                StartDateTime = DateTimeOffset.Parse(startTime),
                Title         = subject,
                PlanId        = planId,
                Assignments   = assignments
                                //BucketId = bucketId
            };
            var plans = await graphClient.Planner.Tasks.Request().AddAsync(plannerTask);

            return(plans);
        }
        public async Task <Beta.PlannerTask> CreatePlannerTaskInBucketAsync(string planId, string bucketId, string subject, string dueDate, string startTime, string userid)
        {
            try
            {
                var graphClient = GetAuthenticatedClient();
                var assignments = new Beta.PlannerAssignments();
                assignments.AddAssignee(userid);

                var plannerTask = new Beta.PlannerTask
                {
                    DueDateTime   = DateTimeOffset.Parse(dueDate),
                    StartDateTime = DateTimeOffset.Parse(startTime),
                    Title         = subject,
                    PlanId        = planId,
                    Assignments   = assignments,
                    BucketId      = bucketId
                };
                var plans = await graphClient.Planner.Tasks.Request().AddAsync(plannerTask).ConfigureAwait(false);

                return(plans);
            }
            catch (Exception ex)
            { throw ex; }
        }