Biplov
Biplov

Reputation: 1142

Microsoft Graph Api Update file version number

I have a document library where I've setup Minor versions for files in that library.

Everytime a file is edited, version gets incremented from 0.1, 0.2, 0.3 etc.

However, I want to be able to update a version number of a file and give it a 2.0 version. I am currently using sharepoint graph api, I tried doing this but it didn't do anything. I made a PATCH request on the file item, with the payload versions like this:

PATCH - https://graph.microsoft.com/v1.0/sites/ceb.sharepoint.com,ab0d7f63-b0d6-4df3-b773-63c493dfb2b1,2dd3d30f-221f-4f2d-9694-30674e5901f9/drives/b!Y38Nq9aw8023c2PEk9-ysQ_T0y0fIi1PlpQwZ05ZAfmWtneAD61ZQ7jfxYuktOWP/items/01NZ7LHEPGYQ7C25UGGFH3L4ZM7LNJOCG5/versions

Payload -

{
    "versions": [
        {
            "id": "5.0",
            "lastModifiedDateTime": "2020-04-09T21:05:13Z",
            "size": 62654,
            "lastModifiedBy": {
                "user": {
                    "displayName": "SharePoint App"
                }
            }
        },
        {
            "id": "6.0",
            "lastModifiedDateTime": "2020-04-09T21:04:50Z",
            "size": 62659,
            "lastModifiedBy": {
                "user": {
                    "displayName": "SharePoint App"
                }
            }
        }
    ]
}

This didn't give me error, but gave me the item back, but version isn't affected by this call at all. Is this possbile?

I wanted to see those two versions in /versions graph API call, but I don't see it.

Upvotes: 0

Views: 692

Answers (1)

Sruthi J
Sruthi J

Reputation: 1602

Currently, only get and post operations are available for DriveItemVersion , No patch operation. you can voice your interest in such a feature or support similar ones in the MS Graph Uservoice forum

Upvotes: 1

Related Questions