How to get Download Url through Download contents of a driveItemVersion resource API

Dipika Das 141 Reputation points
2022-10-11T11:48:31.607+00:00

Hi,

I'm using below api to get previous version download URL.

GET /drives/{drive-id}/items/{item-id}/versions/{version-id}/content

The problem is it's returning the file stream(see below). Can any one help me how I'll find the download URL? because as per the document it'll return the URL. Thanks in Advance

249309-prevverdown.jpg

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,674 questions
{count} votes

2 answers

Sort by: Most helpful
  1. HarmeetSingh7172 4,811 Reputation points
    2022-10-12T13:25:11.017+00:00

    Hi @Dipika Das

    Thanks for reaching out!

    I tried to replicate this issue using my trial tenant account.

    As per the MS documentation, this API retrieves the content of a specific version of a driveItem and we can't get the contents of the current version.

    Please find the screenshot below for reference-

    Endpoint - GET /drives/{drive-id}/items/{item-id}/versions/{version-id}/content  
    

    249719-11.png

    I'm getting the contents of the drive Item file in response.

    Please note that you will not get any download URL in response of GET /drives/{drive-id}/items/{item-id}/versions/{version-id}/content

    However, you can get download URL for a file using GET /drives/{drive-id}/items/{item-id}

    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.


  2. Altosio Admin 0 Reputation points
    2024-04-26T14:41:46.4266667+00:00

    This gives a download URL if your file is bigger than 2GB, otherwise, it returns a stream. If you open a fiddler trace, you should see the link in the header of your graph API call response. This also triggers a call to that download link, so if you're using .Net SDK, you won't see the link as part of HttpResponse.Headers.Location but in ((System.Net.Http.HttpResponseMessage)nativeResponseHandler.Value).RequestMessage.RequestUri

    0 comments No comments