string tenentId = "xxxxxxxx";
string clientId = "xxxxxxx";
string clientScret = "xxxxxxxxx";
// Application permission
ClientSecretCredential clientSecretCredential = new ClientSecretCredential(tenentId, clientId, clientScret);
GraphServiceClient gsClient = new GraphServiceClient(clientSecretCredential);
var plannerAssignments = new PlannerAssignments();
// Add assign to
var plannerAssignment = new PlannerAssignment();
plannerAssignment.OrderHint = " !";
plannerAssignment.OdataType = "#microsoft.graph.plannerAssignment";
plannerAssignments.AdditionalData.Add("af0c0624-3138-446d-9d9e-f86159890745", plannerAssignment);
var requestBody = new PlannerTask
{
PlanId = "wOJWGexB0U-a3n-LZ9nX_2UAD-xT",
BucketId = "RWBdSfn0h0OsFR9XBksEKmUAIgaG",
Title = "Update client list 100",
Assignments = plannerAssignments,
CreatedBy = new IdentitySet() { User = new Identity() { DisplayName= "Adele Vance", Id = "ba8ebefe-fdb9-4ef6-b6c0-80c745d12a0e", OdataType = "#microsoft.graph.identitySet" } }
};
var plannerTaskRes = await gsClient.Planner.Tasks.PostAsync(requestBody);