I want to get the history of a file including the checkin comments from each version.
Calling the graph api like this:
GET /sites/{site-id}/lists/{list-id}/items/{item-id}/versions?expand=fields
gives me a response listing all versions with its fields like this:
(shortened the response by removing unnecessary json-content)
{
"id": "2.0",
"lastModifiedDateTime": "*",
"lastModifiedBy": {
"user": {
}
},
"[email protected]": "*",
"fields": {
"@odata.etag": "*",
"FileLeafRef": "test.txt",
"_Status": "test status",
"_CheckinComment": "commit message for version 2.0", <--- the latest checkin comment
}
},
{
"id": "1.0",
"lastModifiedDateTime": "*",
"lastModifiedBy": {
"user": {
}
},
"[email protected]": "*",
"fields": {
"@odata.etag": "*",
"FileLeafRef": "noLink.txt",
"_Status": "first status",
"_CheckinComment": "commit message for version 2.0", <--- is the same as latest comment
}
}
The response to the call above should include the real checkin comment for each file version:
{
"id": "2.0",
"lastModifiedDateTime": "*",
"lastModifiedBy": {
"user": {
}
},
"[email protected]": "*",
"fields": {
"@odata.etag": "*",
"FileLeafRef": "test.txt",
"_Status": "test status",
"_CheckinComment": "commit message for version 2.0", <--- the latest checkin comment
}
},
{
"id": "1.0",
"lastModifiedDateTime": "*",
"lastModifiedBy": {
"user": {
}
},
"[email protected]": "*",
"fields": {
"@odata.etag": "*",
"FileLeafRef": "noLink.txt",
"_Status": "first status",
"_CheckinComment": "commit message for version 1.0", <--- comment for version 1.0
}
}
Please have a look at this issue and tell me, if I am correct with my assumption, that this is a wrong behavior of the listitem-list-version api.
Or do I miss something?
Regards
schaeferto
I tried to get around this with querying the resource for each specific version. But the request uses the same end point and has the same behavior:
GET /sites/{site-id}/lists/{list-id}/items/{item-id}/versions/1.0?expand=fields
Response
{
"id": "1.0",
"lastModifiedDateTime": "*",
"lastModifiedBy": {
"user": {
}
},
"[email protected]": "*",
"fields": {
"@odata.etag": "*",
"FileLeafRef": "noLink.txt",
"_Status": "first status",
"_CheckinComment": "commit message for version 2.0", <--- wrong comment
}
}
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
@JeremyKelley can we update this page so that the author is not me too? thanks.
Any updates regarding this issue?
It is really important for us, to get the correct commit message for each version of the document.
I'm getting exactly the same problem with version comments.
Request:
https://graph.microsoft.com:443/v1.0/sites/xxx.sharepoint.com:/teams/YYYY:/lists/ZZZ
/items/4/versions?expand=fields(select=Modified,_CheckinComment)&select=id
gives me Result with identical comments for all the versions of a file (they are different when you check through the SharePoint site):
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.list)('ZZZ')/items('4')/versions",
"value": [
{
"id": "2.0",
"[email protected]": "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.list)('ZZZ')/items('4')/versions('2.0')/fields/$entity",
"fields": {
"@odata.etag": "\"...-44feaac173fd,4\"",
"Modified": "2019-12-23T22:43:45Z",
"_CheckinComment": "Checkin2"
}
},
{
"id": "1.0",
"[email protected]": "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.list)('ZZZ')/items('4')/versions('1.0')/fields/$entity",
"fields": {
"@odata.etag": "\"...-44feaac173fd,4\"",
"Modified": "2019-12-23T22:42:20Z",
"_CheckinComment": "Checkin2"
}
}
]
}
"Modified" fields are correct though and correspond to specific version of a file.
Bug in comments?
Can we get some updates/acknowledgement on this?
Any updates on this issue? I'm currently facing this issue using MS Graph Api doing the exact method mentioned above. I get versions with identical comments. @JeremyKelley
Most helpful comment
Any updates regarding this issue?
It is really important for us, to get the correct commit message for each version of the document.