Skip to main content

Notifications

Community site session details

Community site session details

Session Id : lX3IRQsXwGhJ4BKux0AQZU
Power Automate - Power Automate Desktop
Unanswered

How to sync OneDrive when using an Unattended Bot

Like (0) ShareShare
ReportReport
Posted on 12 Dec 2022 02:00:19 by 69

Hello,

 

We have a flow that uses both Power Automate Cloud and Power Automate Desktop. The Power Automate Desktop is tasked with converting an excel online file from extensions .xls to .xlsx. In addition it is coping information from this converted file into another excel online file that is shared with other users. The flow will copy the detail to the shared excel online file, however the other users cannot see the changes as they haven't been synced.

 

I tried using the Run Application action in Power Automate Desktop, however I can't get it to work. OneDrive is installed on the machine, not the user level.

 

Any other ways around this syncing issue when running unattended bots?

 

Thanks

  • Ckatz Profile Picture
    69 on 18 Dec 2022 at 23:55:36
    Re: How to sync OneDrive when using an Unattended Bot

    Thank You everyone for the recommendations- I have been out of the office (sick) and will look into several of these options after the holidays. 

  • momlo Profile Picture
    1,527 Super User 2024 Season 1 on 13 Dec 2022 at 14:28:51
    Re: How to sync OneDrive when using an Unattended Bot

    Hi @Ckatz 

    I do have a combination of PA and PAD flows integrated with OneDrive for a reason.

    How I do it in that flow:

     

    1. PAD bot 1 downloads files from system A, and saves them into OD folder (this is SharePoint library mapped to the local filesystem with OneDrive). OneDrive is set to start automatically on user logon.

    2. PA flow triggers for every new file in a SPO library and performs certain operations, that includes adding data to Excel file in that library then removing the file. This is happening while PAD 1 is still running.

    3. PAD 2 launches. It waits until all files are gone, meaning PA flow did it's job and then waits 5m for OneDrive to fully sync the Excel file.

     

    Now, looking at your case - if you have a premium license - you could try to use build in SharePoint connectors to work with the file, instead of relying on OneDrive (my flow was create before these were added).

     

    If you still want to use OneDrive, without fixed "wait" interval as suggested by @CKN , perhaps this simple trick would help:

     

    1. PA:

    1.1 Create cloud flow that triggers each time your excel file is updated

    1.2 Once trigger (meaning the file was uploaded from desktop) - create text file in the same mapped folder, let's name it: excel_updated.txt

     

    2. PAD

    2.1 Before you edit excel - delete the "excel_updated.txt"

    2.2 Edit the excel file as you do now

    2.3 Now, wait for the "excel_updated.txt" to appear in the folder again (set up the timeout as you need)

    2.4 Complete the flow

     

    So the sequence of actions happening here is:

     

    PAD deletes the excel_updated.txt file -> updates the excel -> pauses -> OneDrive fully syncs the Excel to cloud -> PA discovers that the file was updated and triggers -> PA creates the excel_updated.txt file -> OneDrive syncs the txt file to local folder -> PAD sees the file and continuous to complete the flow

     

    Hope this helps 🙂

  • CKN Profile Picture
    58 on 13 Dec 2022 at 02:48:30
    Re: How to sync OneDrive when using an Unattended Bot

    How large are the files? Is it that the flow doesn't take long enough to let the sync finish then logs out? That is the issue I overcame with the 'wait' flow, my files were too large for the remote machine to sync during the time a flow was run so it needed a dedicated time to do it.

  • VJR Profile Picture
    7,635 on 13 Dec 2022 at 02:41:57
    Re: How to sync OneDrive when using an Unattended Bot

    Hi @Ckatz 

     

    1. In the Run menu type shell:startup and hit Enter

    This will take you to the Startup folder of that machine.

    Add a shortcut to OneDrive in that folder.  (Right click -> New shortcut)

     

    2. Go to the Task Manager of that machine and make sure to enable OneDrive if it is not already.

    VJR_0-1670898867714.png

     

    These two things will ensure that OneDrive kicks-in as soon as the machine is logged in either manually or via a bot.

     

     

    3. Also check out the "Files on demand" and "Always keep on this device" options

    How to keep a local copy of a file or folder when syncing using OneDrive Files On-Demand - YouTube

  • CKN Profile Picture
    58 on 12 Dec 2022 at 22:12:51
    Re: How to sync OneDrive when using an Unattended Bot

    Try building a flow that does nothing but 'Wait' for 5 minutes. This gives OneDrive time to check for updates and make the necessary changes. Run this flow after the file has been generated - it worked for me.

  • Ckatz Profile Picture
    69 on 12 Dec 2022 at 14:09:33
    Re: How to sync OneDrive when using an Unattended Bot

    @VJR Thanks for the suggestion, the folder is listed to sync.

     

    You're right the issue is not a "Power Automate" issue, however due to using the Power Automate Desktop flow in Unattended mode, the OneDrive syncing is being impacted somehow and not syncing until I manually log into the VM...so I thought maybe someone else has run into this issue and found a solution using an action like Run Application in Power Automate Desktop

  • VJR Profile Picture
    7,635 on 12 Dec 2022 at 02:56:46
    Re: How to sync OneDrive when using an Unattended Bot

    Hi @Ckatz 

    I am assuming you are working with a locally mapped folder of OneDrive online (this is the only way to work with desktop flows and OneDrive).


    Since OneDrive has the capability to immediately sync whenever any file is modified or created so this has got to do with OneDrive syncing and not Power Automate Desktop. I recommend going to the settings of OneDrive and check whether this file in question is in the list of folders/files to be synced.

     

    In the tray icon on the bottom right hand side, right click on OneDrive -> Settings -> Choose folders

     

    Would be something like this.

    VJR_0-1670813700883.png

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,670 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard