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)
Sites.Manage.All
Delegated (personal Microsoft account)
Not supported.
Application
Sites.Manage.All
HTTP request
POST https://graph.microsoft.com/v1.0/sites/{site-id}/lists
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 list object.
Response
If successful, this method returns a 201 Created response code and a list object in the response body.
Examples
Request
The following is an example of how to create a new generic list.
Note: Custom columns are optional.
In addition to any columns specified here, new lists are created with columns defined in the referenced template.
If the list facet or template is unspecified, the list defaults to the genericList template, which includes a Title column.
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var list = new List
{
DisplayName = "Books",
Columns = new ListColumnsCollectionPage()
{
new ColumnDefinition
{
Name = "Author",
Text = new TextColumn
{
}
},
new ColumnDefinition
{
Name = "PageCount",
Number = new NumberColumn
{
}
}
},
ListInfo = new ListInfo
{
Template = "genericList"
}
};
await graphClient.Sites["{site-id}"].Lists
.Request()
.AddAsync(list);
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new List();
$requestBody->setDisplayName('Books');
$columnsColumnDefinition1 = new ColumnDefinition();
$columnsColumnDefinition1->setName('Author');
$columnsColumnDefinition1Text = new TextColumn();
$columnsColumnDefinition1->setText($columnsColumnDefinition1Text);
$columnsArray []= $columnsColumnDefinition1;
$columnsColumnDefinition2 = new ColumnDefinition();
$columnsColumnDefinition2->setName('PageCount');
$columnsColumnDefinition2Number = new NumberColumn();
$columnsColumnDefinition2->setNumber($columnsColumnDefinition2Number);
$columnsArray []= $columnsColumnDefinition2;
$requestBody->setColumns($columnsArray);
$list = new ListInfo();
$list->setTemplate('genericList');
$requestBody->setList($list);
$requestResult = $graphServiceClient->sitesById('site-id')->lists()->post($requestBody);