Namespace: microsoft.graph
Wichtig
Die APIs unter der /beta Version in Microsoft Graph können sich ändern. Die Verwendung dieser APIs in Produktionsanwendungen wird nicht unterstützt. Um festzustellen, ob eine API in v1.0 verfügbar ist, verwenden Sie die Version Selektor.
Gibt die Metadaten für eine Liste zurück.
Diese API ist in den folgenden nationalen Cloudbereitstellungen verfügbar.
| Weltweiter Service |
US Government L4 |
US Government L5 (DOD) |
China, betrieben von 21Vianet |
| ✅ |
✅ |
✅ |
✅ |
Berechtigungen
Wählen Sie die Berechtigungen aus, die für diese API als am wenigsten privilegiert markiert sind. Verwenden Sie eine höhere Berechtigung oder Berechtigungen nur, wenn Ihre App dies erfordert. Ausführliche Informationen zu delegierten Berechtigungen und Anwendungsberechtigungen finden Sie unter Berechtigungstypen. Weitere Informationen zu diesen Berechtigungen finden Sie in der Berechtigungsreferenz.
| Berechtigungstyp |
Berechtigungen mit den geringsten Berechtigungen |
Berechtigungen mit höheren Berechtigungen |
| Delegiert (Geschäfts-, Schul- oder Unikonto) |
Sites.Read.All |
Sites.ReadWrite.All |
| Delegiert (persönliches Microsoft-Konto) |
Nicht unterstützt |
Nicht unterstützt |
| Anwendung |
Sites.Read.All |
Sites.ReadWrite.All |
HTTP-Anforderung
GET /sites/{site-id}/lists/{list-id}
GET /sites/{site-id}/lists/{list-title}
GET /sites/{site-id}/lists/{list-id}?expand=columns,items(expand=fields)
Anforderungstext
Bei dieser Methode wird kein Anforderungstext angegeben.
Beispiel
Anforderung
GET /sites/{site-id}/lists/{list-id}
// Code snippets are only available for the latest version. Current version is 5.x
// 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["{list-id}"].GetAsync();
// 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"
//other-imports
)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
lists, err := graphClient.Sites().BySiteId("site-id").Lists().ByListId("list-id").Get(context.Background(), nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
List result = graphClient.sites().bySiteId("{site-id}").lists().byListId("{list-id}").get();
const options = {
authProvider,
};
const client = Client.init(options);
let list = await client.api('/sites/{site-id}/lists/{list-id}')
.version('beta')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$result = $graphServiceClient->sites()->bySiteId('site-id')->lists()->byListId('list-id')->get()->wait();
Import-Module Microsoft.Graph.Beta.Sites
Get-MgBetaSiteList -SiteId $siteId -ListId $listId
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
result = await graph_client.sites.by_site_id('site-id').lists.by_list_id('list-id').get()
Antwort
HTTP/1.1 200 OK
Content-type: application/json
{
"id": "1234-112-112-4",
"name": "MicroFeed",
"createdDateTime": "2016-08-30T08:32:00Z",
"lastModifiedDateTime": "2016-08-30T08:32:00Z",
"list": {
"hidden": false,
"template": "genericList"
}
}
Mit select- und expand-Anweisungen können Sie Listen-Metadaten, Spaltendefinitionen und Listenelemente in einer einzigen Anforderung abrufen.
Anforderung
Das folgende Beispiel zeigt, wie Sie eine Liste aus einem SharePoint Online-Listentitel abrufen.
GET /sites/{site-id}/lists/{list-title}
// Code snippets are only available for the latest version. Current version is 5.x
// 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["{list-id}"].GetAsync();
// 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"
//other-imports
)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
lists, err := graphClient.Sites().BySiteId("site-id").Lists().ByListId("list-id").Get(context.Background(), nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
List result = graphClient.sites().bySiteId("{site-id}").lists().byListId("{list-id}").get();
const options = {
authProvider,
};
const client = Client.init(options);
let list = await client.api('/sites/{site-id}/lists/{list-title}')
.version('beta')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$result = $graphServiceClient->sites()->bySiteId('site-id')->lists()->byListId('list-id')->get()->wait();
Import-Module Microsoft.Graph.Beta.Sites
Get-MgBetaSiteList -SiteId $siteId -ListId $listId
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
result = await graph_client.sites.by_site_id('site-id').lists.by_list_id('list-id').get()
Antwort
HTTP/1.1 200 OK
Content-type: application/json
{
"id": "1234-112-112-4",
"name": "MicroFeed",
"createdDateTime": "2016-08-30T08:32:00Z",
"lastModifiedDateTime": "2016-08-30T08:32:00Z",
"list": {
"hidden": false,
"template": "genericList"
}
}
Mit select- und expand-Anweisungen können Sie Listen-Metadaten, Spaltendefinitionen und Listenelemente in einer einzigen Anforderung abrufen.
Anforderung
GET /sites/{site-id}/lists/{list-id}?select=name,lastModifiedDateTime&expand=columns(select=name,description),items(expand=fields(select=Name,Color,Quantity))
// Code snippets are only available for the latest version. Current version is 5.x
// 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["{list-id}"].GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Select = new string []{ "name","lastModifiedDateTime" };
requestConfiguration.QueryParameters.Expand = new string []{ "columns(select=name,description)","items(expand=fields(select=Name,Color,Quantity)",")" };
});
// 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"
graphsites "github.com/microsoftgraph/msgraph-beta-sdk-go/sites"
//other-imports
)
requestParameters := &graphsites.ItemListsItemRequestBuilderGetQueryParameters{
Select: [] string {"name","lastModifiedDateTime"},
Expand: [] string {"columns(select=name,description)","items(expand=fields(select=Name,Color,Quantity)",")"},
}
configuration := &graphsites.ItemListsItemRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
lists, err := graphClient.Sites().BySiteId("site-id").Lists().ByListId("list-id").Get(context.Background(), configuration)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
List result = graphClient.sites().bySiteId("{site-id}").lists().byListId("{list-id}").get(requestConfiguration -> {
requestConfiguration.queryParameters.select = new String []{"name", "lastModifiedDateTime"};
requestConfiguration.queryParameters.expand = new String []{"columns(select=name,description)", "items(expand=fields(select=Name,Color,Quantity)", ")"};
});
const options = {
authProvider,
};
const client = Client.init(options);
let list = await client.api('/sites/{site-id}/lists/{list-id}?select=name,lastModifiedDateTime&expand=columns(select=name,description),items(expand=fields(select=Name,Color,Quantity))')
.version('beta')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Sites\Item\Lists\Item\ListItemRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new ListItemRequestBuilderGetRequestConfiguration();
$queryParameters = ListItemRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->select = ["name","lastModifiedDateTime"];
$queryParameters->expand = ["columns(select=name,description)","items(expand=fields(select=Name,Color,Quantity)",")"];
$requestConfiguration->queryParameters = $queryParameters;
$result = $graphServiceClient->sites()->bySiteId('site-id')->lists()->byListId('list-id')->get($requestConfiguration)->wait();
Import-Module Microsoft.Graph.Beta.Sites
Get-MgBetaSiteList -SiteId $siteId -ListId $listId -Property "name,lastModifiedDateTime" -ExpandProperty "columns(select=name,description),items)"
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.sites.item.lists.item.list_item_request_builder import ListItemRequestBuilder
from kiota_abstractions.base_request_configuration import RequestConfiguration
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
query_params = ListItemRequestBuilder.ListItemRequestBuilderGetQueryParameters(
select = ["name","lastModifiedDateTime"],
expand = ["columns(select=name,description)","items(expand=fields(select=Name,Color,Quantity)",")"],
)
request_configuration = RequestConfiguration(
query_parameters = query_params,
)
result = await graph_client.sites.by_site_id('site-id').lists.by_list_id('list-id').get(request_configuration = request_configuration)
Antwort
HTTP/1.1 200 OK
Content-type: application/json
{
"name": "Inventory",
"lastModifiedDateTime": "2016-08-30T08:32:00Z",
"columns": [
{
"name": "Name",
"description": "Customer-facing name of the SKU"
},
{
"name": "Color",
"description": "Color of the item in stock"
},
{
"name": "Quantity",
"description": "Number of items in stock"
}
],
"items": [
{
"id": "2",
"fields": {
"Name": "Gadget",
"Color": "Red",
"Quantity": 503
}
},
{
"id": "4",
"fields": {
"Name": "Widget",
"Color": "Blue",
"Quantity": 2357
}
},
{
"id": "7",
"fields": {
"Name": "Gizmo",
"Color": "Green",
"Quantity": 92
}
}
]
}
Anforderung
Das folgende Beispiel zeigt, wie Sie Metadaten für eine Liste abrufen, die drei Spalten enthält: Name, Menge und Kategorie.
Verwaltete Metadatenspalten wie Category Rückgabewerte als Ausdrucks-ID und Ausdrucksnamenpaar.
GET /sites/{site-id}/lists/{list-id}?select=name,lastModifiedDateTime&expand=columns(select=name,description),items(expand=fields(select=Name,Quantity,Category))
Antwort
HTTP/1.1 200 OK
Content-type: application/json
{
"name": "Inventory",
"lastModifiedDateTime": "2016-08-30T08:32:00Z",
"columns": [
{
"name": "Name",
"description": "Customer-facing name of the SKU"
},
{
"name": "Quantity",
"description": "Number of items in stock"
},
{
"name": "Category",
"description": "Category of the item"
}
],
"items": [
{
"id": "2",
"fields": {
"Name": "Gadget",
"Quantity": 503,
"Category": {
"termId": "791d537a-9c1c-3b05-97b0-1ce7ece7e1a4",
"name": "Tool"
}
}
},
{
"id": "4",
"fields": {
"Name": "Widget",
"Quantity": 2357,
"Category": {
"termId": "902e568b-9b2d-4d06-87c2-2cf8ecf9f2b5" ,
"name": "Mechanical Device"
}
}
}
]
}