question

DeepaliDwivedi-5357 avatar image
0 Votes"
DeepaliDwivedi-5357 asked DianaWanjuhi-1579 answered

What is the best way to idenitfy if the file is changing in SharePoint?

My use case is, I need to download the file from SharePoint and do some processing and upload it back.

In my case sometimes the file that is downloaded is corrupt. I could see some incomplete file in CustomXML folder after unzipping the docx file.

Is there any way to verify if the file after downloaded is corrupt or not programmatically?

Can we use cTag to verify if the file is changed during the process as the file downloaded while uploading is not corrupted?

What is the proper way of doing it?

microsoft-graph-sdk
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

DianaWanjuhi-1579 avatar image
0 Votes"
DianaWanjuhi-1579 answered

Hello @DeepaliDwivedi-5357 thank you for reaching out. Please see docs on downloading the contents of a DriveItem. This API returns a 302 Found` response redirecting to a pre-authenticated download URL for the file. This is the same URL available through the @microsoft.graph.downloadUrl property on the DriveItem. To download the contents of the file your application will need to follow the Location header in the response.


You may also supply this optional request header, if-none-match If included and the cTag provided matches the current tag on the file, an HTTP 304 Not Modified
response is returned.

What sdk are you using to make the request?

Please let me know if this helps and if you have further questions,

Diana.



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.