Get a ListItemVersion resource
Article
08/04/2022
2 minutes to read
8 contributors
Feedback
In this article
Namespace: microsoft.graph
Retrieve the metadata for a specific version of a ListItem .
Permissions
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.Read.All, Sites.ReadWrite.All
Delegated (personal Microsoft account)
n/a
Application
Sites.Read.All, Sites.ReadWrite.All
HTTP request
GET /sites/{site-id}/items/{item-id}/versions/{version-id}
GET /sites/{site-id}/lists/{list-id}/items/{item-id}/versions/{version-id}
Response
If successful, this method returns a 200 OK
response code and a ListItemVersion object in the response body.
Example
This example retrieves a version of a listItem and expands the fields collection to request the values of fields in the listItem.
HTTP request
GET /sites/{site-id}/lists/{list-id}/items/{item-id}/versions/{version-id}?expand=fields
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var queryOptions = new List<QueryOption>()
{
new QueryOption("expand", "fields")
};
var listItemVersion = await graphClient.Sites["{site-id}"].Lists["{list-id}"].Items["{listItem-id}"].Versions["{listItemVersion-id}"]
.Request( queryOptions )
.GetAsync();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
const options = {
authProvider,
};
const client = Client.init(options);
let listItemVersion = await client.api('/sites/{site-id}/lists/{list-id}/items/{item-id}/versions/{version-id}?expand=fields')
.get();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
LinkedList<Option> requestOptions = new LinkedList<Option>();
requestOptions.add(new QueryOption("expand", "fields"));
ListItemVersion listItemVersion = graphClient.sites("{site-id}").lists("{list-id}").items("{item-id}").versions("{version-id}")
.buildRequest( requestOptions )
.get();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestParameters := &graphconfig.ListItemVersionRequestBuilderGetQueryParameters{
Expand: [] string {"fields"},
}
configuration := &graphconfig.ListItemVersionRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
result, err := graphClient.SitesById("site-id").ListsById("list-id").ItemsById("listItem-id").VersionsById("listItemVersion-id").Get(context.Background(), configuration)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Import-Module Microsoft.Graph.Sites
Get-MgSiteListItemVersion -SiteId $siteId -ListId $listId -ListItemId $listItemId -ListItemVersionId $listItemVersionId -ExpandProperty "fields"
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestConfiguration = new ListItemVersionRequestBuilderGetRequestConfiguration();
$queryParameters = new ListItemVersionRequestBuilderGetQueryParameters();
$queryParameters->expand = ["fields"];
$requestConfiguration->queryParameters = $queryParameters;
$requestResult = $graphServiceClient->sitesById('site-id')->listsById('list-id')->itemsById('listItem-id')->versionsById('listItemVersion-id')->get($requestConfiguration);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Response
This returns a collection of versions:
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": "1.0",
"lastModifiedBy": {
"user": {
"id": "CE251278-EF9E-4FE5-833C-1D89EEAE68E0",
"displayName": "Ryan Gregg"
}
},
"lastModifiedDateTime": "2017-09-14T12:34:53.912Z",
"fields": { }
}