Microsoft 365 activities not downloading the latest version of the file

Hello UiPath Community,

I am using Microsoft 365 (Graph API) to download a file from Sharepoint online but I am not getting the latest version.

I found the Microsoft article below and it recommends to add the “persistChanges”: true param but since this package is embedded I do not know how could add it to my sequence.

Microsoft Graph Files API - not downloading the latest version of the file - Microsoft Q&A

Any help would be appreciated.

Thank you

@silrochagomes

With the current activities yes we cannot do this…if the file is closed after the update then you can get the updates as well…but if it is open i beleive as of now you cannot with activities

Instead you can try using http request activity in UiPath and call graph api from there

Cheers

Hi @silrochagomes

Can you try this-

  1. Create a new HTTP Request activity in UiPath.

  2. Set the following properties for the activity:
    Method: GET
    Endpoint: Enter the URL for downloading the file from SharePoint.
    Example: https://graph.microsoft.com/v1.0/sites/{site-id}/drive/items/{item-id}/content?persistChanges=true
    Headers: Set the necessary headers for authentication (e.g., Authorization header with the access token).

  3. Send the HTTP Request and handle the response to download the file.
    By adding the persistChanges=true parameter to the URL, you are instructing the Graph API to always return the latest version of the file.

Thanks!!

If you use Window Legacy, it is also possible to reuse existing O365 scope and use Invoke Code activities to achieve what you want. See:
https://docs.uipath.com/activities/other/latest/user-guide/office365-troubleshooting-authentication#graph-api-requests-within-microsoft-office-365-scope