Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
Permission type
Least privileged permissions
Higher privileged permissions
Delegated (work or school account)
Sites.Manage.All
Not available.
Delegated (personal Microsoft account)
Not supported.
Not supported.
Application
Sites.Manage.All
Sites.ReadWrite.All
HTTP request
POST /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.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new List
{
DisplayName = "Books",
Columns = new List<ColumnDefinition>
{
new ColumnDefinition
{
Name = "Author",
Text = new TextColumn
{
},
},
new ColumnDefinition
{
Name = "PageCount",
Number = new NumberColumn
{
},
},
},
List = new ListInfo
{
Template = "genericList",
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Sites["{site-id}"].Lists.PostAsync(requestBody);
<?php
// THIS SNIPPET IS A PREVIEW VERSION OF THE SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new EscapedList();
$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->setEscapedList($list);
$result = $graphServiceClient->sites()->bySiteId('site-id')->lists()->post($requestBody)->wait();
# THE PYTHON SDK IS IN PREVIEW. FOR NON-PRODUCTION USE ONLY
graph_client = GraphServiceClient(credentials, scopes)
request_body = List_(
display_name = "Books",
columns = [
ColumnDefinition(
name = "Author",
text = TextColumn(
),
),
ColumnDefinition(
name = "PageCount",
number = NumberColumn(
),
),
],
list = ListInfo(
template = "genericList",
),
)
result = await graph_client.sites.by_site_id('site-id').lists.post(request_body)