Create todoTaskList
Article
03/02/2023
4 contributors
Feedback
In this article
Namespace: microsoft.graph
Create a new lists object.
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
Delegated (personal Microsoft account)
Tasks.ReadWrite
Application
Tasks.ReadWrite.All
HTTP request
POST /me/todo/lists
POST /users/{id|userPrincipalName}/todo/lists
Name
Description
Authorization
Bearer {token}. Required.
Content-Type
application/json. Required.
Request body
In the request body, supply a JSON representation of the todoTaskList object.
The following table shows the properties that are required when you create the todoTaskList .
Property
Type
Description
displayName
String
Field indicating title of the task list.
Response
If successful, this method returns a 201 Created
response code and a todoTaskList object in the response body.
Examples
Request
POST https://graph.microsoft.com/v1.0/me/todo/lists
Content-Type: application/json
{
"displayName": "Travel items"
}
// Code snippets are only available for the latest version. Current version is 5.x
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new TodoTaskList
{
DisplayName = "Travel items",
};
var result = await graphClient.Me.Todo.Lists.PostAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestBody := graphmodels.NewTodoTaskList()
displayName := "Travel items"
requestBody.SetDisplayName(&displayName)
result, err := graphClient.Me().Todo().Lists().Post(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
TodoTaskList todoTaskList = new TodoTaskList();
todoTaskList.displayName = "Travel items";
graphClient.me().todo().lists()
.buildRequest()
.post(todoTaskList);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
const options = {
authProvider,
};
const client = Client.init(options);
const todoTaskList = {
displayName: 'Travel items'
};
await client.api('/me/todo/lists')
.post(todoTaskList);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new TodoTaskList();
$requestBody->setDisplayName('Travel items');
$result = $graphServiceClient->me()->todo()->lists()->post($requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Import-Module Microsoft.Graph.Users
$params = @{
displayName = "Travel items"
}
# A UPN can also be used as -UserId.
New-MgUserTodoList -UserId $userId -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Response
Note: The response object shown here might be shortened for readability.
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.todoTaskList",
"id": "AAMkADIyAAAhrbPWAAA=",
"displayName": "Travel items",
"isOwner": true,
"isShared": false,
"wellknownListName": "none"
}