Namespace: microsoft.graph
Important
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 lists object.
This API is available in the following national cloud deployments.
| Global service |
US Government L4 |
US Government L5 (DOD) |
China operated by 21Vianet |
| ✅ |
✅ |
✅ |
❌ |
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
Request body
In the request body, supply a JSON representation of the todoTaskList object.
The following table lists 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/beta/me/todo/lists
Content-Type: application/json
{
"displayName": "Travel items"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new TodoTaskList
{
DisplayName = "Travel items",
};
// To initialize your graphClient, see https://free.blessedness.top/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Me.Todo.Lists.PostAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewTodoTaskList()
displayName := "Travel items"
requestBody.SetDisplayName(&displayName)
// To initialize your graphClient, see https://free.blessedness.top/en-us/graph/sdks/create-client?from=snippets&tabs=go
lists, err := graphClient.Me().Todo().Lists().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
TodoTaskList todoTaskList = new TodoTaskList();
todoTaskList.setDisplayName("Travel items");
TodoTaskList result = graphClient.me().todo().lists().post(todoTaskList);
const options = {
authProvider,
};
const client = Client.init(options);
const todoTaskList = {
displayName: 'Travel items'
};
await client.api('/me/todo/lists')
.version('beta')
.post(todoTaskList);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\TodoTaskList;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new TodoTaskList();
$requestBody->setDisplayName('Travel items');
$result = $graphServiceClient->me()->todo()->lists()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Users
$params = @{
displayName = "Travel items"
}
# A UPN can also be used as -UserId.
New-MgBetaUserTodoList -UserId $userId -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.todo_task_list import TodoTaskList
# To initialize your graph_client, see https://free.blessedness.top/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = TodoTaskList(
display_name = "Travel items",
)
result = await graph_client.me.todo.lists.post(request_body)
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"
}