Getting access to a OneDrive DriveItemVersion

Stephen Gray 40 Reputation points
2023-02-09T21:26:02.34+00:00
Hi there,

Actually I'm trying to access older versions of my Excel files. I can get a list with "/versions". I can get some detail information about a specific version with "/versions/x.0.

But getting the content is not working for me (no specific error message)

Graph Explorer
https://graph.microsoft.com/v1.0/me/drive/items/01Y5BOJUKNFSJVM6VB6J.../versions/2.0/content
   

Is it possible to get access to driveItems based on a DriveItemVersion?
Or download such an old version?

I appreciate your help. Thanks in advance

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,005 questions
OneDrive
OneDrive
A Microsoft file hosting and synchronization service.
1,110 questions
0 comments No comments
{count} votes

Accepted answer
  1. Gopinath Chennamadhavuni 2,436 Reputation points
    2023-02-16T14:29:32.0366667+00:00

    Hello Stephen Gray,

    Thanks for reaching out!

    As per the details provided, you're trying to use Download contents of a driveItemVersion graph API in Graph Explorer. For this API, the response content is not available in Graph Explorer due to CORS (Cross-Origin Resource Sharing) policy. You can execute this same endpoint/request in an API client, like Postman and it will work as expected.

    Refer this to know about CORS.

    Got the CORS error while trying to get the content of DriveItem version using GRAPH API: me/drive/items/{items-id}/versions/{version-id}/content from Graph Explorer.

    Cors_graph

    Got the successful response from Postman with same API endpoint.

    Cors_Postman

    Please note that, we can't get the content of current version using above graph API. To get the content of current version use: me/drive/items/{items-id}/content

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Michael Taylor 54,316 Reputation points
    2023-02-09T21:37:54.08+00:00

    Use the /versions/{version-id}/content endpoint to get a URL that will allow you to download a specific version. You can read more about it here.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.