// 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();
# 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()
// 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();
# 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()
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.SiteItemListItemRequestBuilderGetQueryParameters{
Select: [] string {"name","lastModifiedDateTime"},
Expand: [] string {"columns(select=name,description)","items(expand=fields(select=Name,Color,Quantity)",")"},
}
configuration := &graphsites.SiteItemListItemRequestBuilderGetRequestConfiguration{
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)", ")"};
});
# 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)
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
}
}
]
}
请求
以下示例演示如何获取包含三列的列表的元数据:名称、数量和类别。
托管元数据 列(如 Category 作为术语 ID 和术语名称对)返回值。
GET /sites/{site-id}/lists/{list-id}?select=name,lastModifiedDateTime&expand=columns(select=name,description),items(expand=fields(select=Name,Quantity,Category))