Для вызова этого API требуется одно из следующих разрешений. Дополнительные сведения, включая сведения о том, как выбрать разрешения, см. в статье Разрешения.
Тип разрешения
Разрешения (в порядке повышения привилегий)
Делегированные (рабочая или учебная учетная запись)
Tasks.ReadWrite
Делегированные (личная учетная запись Майкрософт)
Tasks.ReadWrite
Для приложений
Tasks.ReadWrite.All
HTTP-запрос
POST /me/todo/lists
POST /users/{id|userPrincipalName}/todo/lists
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
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new TodoTaskList
{
DisplayName = "Travel items",
};
// To initialize your graphClient, see https://learn.microsoft.com/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 $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewTodoTaskList()
displayName := "Travel items"
requestBody.SetDisplayName(&displayName)
// To initialize your graphClient, see https://learn.microsoft.com/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);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\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.Users
$params = @{
displayName = "Travel items"
}
# A UPN can also be used as -UserId.
New-MgUserTodoList -UserId $userId -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.todo_task_list import TodoTaskList
# To initialize your graph_client, see https://learn.microsoft.com/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)