APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
Create a new plannerTask.
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
Permission type
Permissions (from least to most privileged)
Delegated (work or school account)
Tasks.ReadWrite, Group.ReadWrite.All
Delegated (personal Microsoft account)
Not supported.
Application
Not supported.
HTTP request
POST /planner/tasks
Request headers
Name
Description
Authorization
Bearer {token}. Required.
Content-Type
application/json. Required.
Request body
In the request body, supply a JSON representation of a plannerTask object.
The plannerTask planId property must be set to an existing plannerPlan object's ID.
Response
If successful, this method returns a 201 Created response code and a plannerTask object in the response body.
This method can return any of the HTTP status codes. The most common errors that apps should handle for this method are the 400, 403 and 404 responses. For more information about these errors, see Common Planner error conditions.
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var plannerTask = new PlannerTask
{
PlanId = "xqQg5FS2LkCp935s-FIFm2QAFkHM",
BucketId = "hsOf2dhOJkqyYYZEtdzDe2QAIUCR",
Title = "Update client list",
Assignments = new PlannerAssignments
{
AdditionalData = new Dictionary<string, object>()
{
{"fbab97d0-4932-4511-b675-204639209557", "{\"@odata.type\":\"#microsoft.graph.plannerAssignment\",\"orderHint\":\" !\"}"}
}
}
};
await graphClient.Planner.Tasks
.Request()
.AddAsync(plannerTask);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := graphmodels.NewPlannerTask()
planId := "xqQg5FS2LkCp935s-FIFm2QAFkHM"
requestBody.SetPlanId(&planId)
bucketId := "hsOf2dhOJkqyYYZEtdzDe2QAIUCR"
requestBody.SetBucketId(&bucketId)
title := "Update client list"
requestBody.SetTitle(&title)
assignments := graphmodels.NewPlannerAssignments()
additionalData := map[string]interface{}{
"fbab97d0-4932-4511-b675-204639209557" := graphmodels.New()
"@odata.type" := "#microsoft.graph.plannerAssignment"
"fbab97d0-4932-4511-b675-204639209557".Set"@odata.type"(&"@odata.type")
orderHint := " !"
"fbab97d0-4932-4511-b675-204639209557".SetOrderHint(&orderHint)
assignments.Set"fbab97d0-4932-4511-b675-204639209557"("fbab97d0-4932-4511-b675-204639209557")
}
assignments.SetAdditionalData(additionalData)
requestBody.SetAssignments(assignments)
result, err := graphClient.Planner().Tasks().Post(requestBody)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new PlannerTask();
$requestBody->setPlanId('xqQg5FS2LkCp935s-FIFm2QAFkHM');
$requestBody->setBucketId('hsOf2dhOJkqyYYZEtdzDe2QAIUCR');
$requestBody->setTitle('Update client list');
$assignments = new PlannerAssignments();
$additionalData = [
'fbab97d0-4932-4511-b675-204639209557' => $assignments = new Fbab97d0-4932-4511-b675-204639209557();
$ assignments->set@odatatype('#microsoft.graph.plannerAssignment');
$ assignments->setOrderHint(' !');
$assignments->setFbab97d0-4932-4511-b675-204639209557($fbab97d0-4932-4511-b675-204639209557);
];
$assignments->setAdditionalData($additionalData);
$requestBody->setAssignments($assignments);
$requestResult = $graphServiceClient->planner()->tasks()->post($requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.