The issue you are experiencing is likely due to the fact that the SharePoint tab is still open and the changes have not been saved to the server yet. To ensure that the latest changes are retrieved from the server, you should close the SharePoint tab before making the API call to retrieve the download URL. Additionally, you can use the Files.ReadWrite.All
permission to ensure that the latest version of the file is retrieved.
"Download the contents of a DriveItem" does not return the latest changes before the browser tab is closed
Hi :),
We have an integration that enables our users to upload .docx (and similar files) to our platform and then edit them online (SharePoint).
When a user decides to edit a file we upload it temporarily to SharePoint (https://learn.microsoft.com/en-us/graph/api/driveitem-put-content?view=graph-rest-1.0&tabs=http).
The online Word editor automatically saves all changes on the fly.
When the user has completed the changes they click a button in our platform to download the latest changes to our platform and update the file on our end.
What I've discovered is that the file does not get updated with the latest changes as long as the SharePoint tab is open.
If I run the request to get the download URL and access it manually I get the old version until I manually close the tab, then I get the latest changes.
Documentation: https://learn.microsoft.com/en-us/graph/api/driveitem-get-content?view=graph-rest-1.0&tabs=http
I can also get the latest version from the online editor through: File > Save as > Download a Copy. But we need to do this through the API.
Any ideas?
Regards, Mikael
1 answer
Sort by: Most helpful
-
Diya Ahuja 5 Reputation points
2023-06-30T18:06:27.8633333+00:00