10-04-25 07:03 AM
I have obtained the onedrive link to where the excels should be synced. Now i need to sync all the excel input files to the onedrive folder. Could you please help on this to write the code
09-06-25 10:43 AM
Hi @vsekar1,
There are two primary ways to sync your Excel files to OneDrive using Blue Prism:
Local Sync via OneDrive Folder:
If OneDrive is installed and configured to sync locally, it creates a folder on your machine that automatically syncs with the cloud. You can simply use the Utility - File Management actions in Blue Prism to move or copy your Excel files into that folder.
Direct Upload via OneDrive/Graph API:
If you prefer to upload files directly to OneDrive without relying on local sync, you can use the Microsoft Graph API. This requires:
If you need further details on either method, feel free to reply with your specific use case. If you found this information useful, please consider marking this response as the Best Answer.
09-06-25 12:29 PM
Hi @vsekar1
If you have the one drive setup in the run server or where the process is running just place those files in that folder as automatically it will sync with onedrive cloud.
2 weeks ago
Hi @vsekar1,
I created a specific object to force sync in OneDrive:
<process name="__selection__OneDrive Sync" type="object" runmode="Exclusive"><stage stageid="187c59fe-b217-410f-83f8-08e976c56d10" name="End" type="End"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><loginhibit /><display x="15" y="435" /><breakpoint type="0"><condition></condition></breakpoint></stage><stage stageid="da1c01c9-650d-4142-9ba3-2715680a15a9" name="Get LocalApplicationData" type="Code"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><loginhibit /><display x="15" y="-105" /><outputs><output type="text" name="applocalPath" stage="applocalPath" /></outputs><onsuccess>a8d01ce4-4984-4830-a699-9f9118a4f4ba</onsuccess><code><![CDATA[applocalPath = GetFolderPath(SpecialFolder.LocalApplicationData)]]></code></stage><stage stageid="bc3768b9-2c96-4f7c-88fb-dd149f2662d0" name="applocalPath" type="Data"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><display x="-90" y="-15" /><datatype>text</datatype><initialvalue /><private /><alwaysinit /></stage><stage stageid="a8d01ce4-4984-4830-a699-9f9118a4f4ba" name="Set applocalPath" type="Calculation"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><loginhibit /><display x="15" y="-45" /><onsuccess>89ab2a49-fda5-435f-ad6a-ef5278e5d07e</onsuccess><calculation expression="[applocalPath]&"\Microsoft\OneDrive\logs\Business1"" stage="applocalPathLog" /></stage><stage stageid="83e18a5c-5d04-44e9-9cfd-698d4beda795" name="applocalPathLog" type="Data"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><display x="-150" y="-150" /><datatype>text</datatype><initialvalue /><private /><alwaysinit /></stage><stage stageid="8b01f28a-8a0e-4cb4-bafc-09d6b2703832" name="Utility - File Management::Read All Text from File" type="Action"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><loginhibit onsuccess="true" /><display x="15" y="255" /><inputs><input type="text" name="File Name" friendlyname="File Name" narrative="The full path the file to read the text from" expr="[applocalPathLog]&"\SyncDiagnostics.log"" /></inputs><outputs><output type="flag" name="Success" friendlyname="Success" narrative="True if successful" stage="" /><output type="text" name="Message" friendlyname="Message" narrative="An error message if unsuccessful" stage="" /><output type="text" name="Text" friendlyname="Text" narrative="The text of the file" stage="Text" /></outputs><onsuccess>94301e8e-0cac-49a9-959c-b3a32183d936</onsuccess><resource object="Utility - File Management" action="Read All Text from File" /></stage><stage stageid="04c21435-ec66-4498-8596-eb1a23cb8798" name="Text" type="Data"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><display x="-150" y="-105" /><datatype>text</datatype><initialvalue /><private /><alwaysinit /></stage><stage stageid="0bce37c8-3dc6-4b4e-9a9e-423f9b647217" name="[Retry] + 1" type="Calculation"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><loginhibit /><display x="195" y="255" /><onsuccess>35436217-533e-4a12-8dfc-d63ee8712872</onsuccess><calculation expression="[Retry] + 1" stage="Retry" /></stage><stage stageid="97371474-7e57-450a-9353-3f2e960ea5a1" name="Retry" type="Data"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><loginhibit /><display x="-90" y="-105" /><datatype>number</datatype><initialvalue>0</initialvalue><private /><alwaysinit /></stage><stage stageid="35436217-533e-4a12-8dfc-d63ee8712872" name="Sleep 2 sec" type="Action"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><loginhibit onsuccess="true" /><display x="105" y="255" /><inputs><input type="number" name="Sleep Time (Seconds)" friendlyname="Sleep Time (Seconds)" narrative="The time (in seconds) for which to sleep" expr="2" /></inputs><onsuccess>8b01f28a-8a0e-4cb4-bafc-09d6b2703832</onsuccess><resource object="Utility - General" action="Sleep" /></stage><stage stageid="94301e8e-0cac-49a9-959c-b3a32183d936" name="InStr([Text]; "SyncProgressState: 16777216") > 0 OR InStr([Text]; "SyncProgressState: 0") > 0" type="Decision"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><loginhibit /><display x="15" y="315" /><decision expression="InStr([Text], "SyncProgressState: 16777216") > 0 OR InStr([Text], "SyncProgressState: 0") > 0" /><ontrue>02864d7d-50aa-4829-93e6-7ae7ddcaaaee</ontrue><onfalse>8dea9f86-d5cb-4519-90ac-c9fd3016bcd9</onfalse></stage><stage stageid="8dea9f86-d5cb-4519-90ac-c9fd3016bcd9" name="InStr([Text]; "SyncProgressState: 65536") > 0" type="Decision"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><loginhibit /><display x="105" y="315" /><decision expression="InStr([Text], "SyncProgressState: 65536") > 0" /><ontrue>ea413de1-fa98-47a5-b23d-582b3a5fdb7a</ontrue><onfalse>ad11b76a-cf85-49ff-b8e4-cba240d9fbd8</onfalse></stage><stage stageid="bf19237b-8b8c-478c-99ab-af37ae54a909" name="Exception Pause" type="Exception"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><display x="105" y="435" /><breakpoint type="0"><condition></condition></breakpoint><exception localized="yes" type="System Exception" detail=""OneDrive in Pause Status"" /></stage><stage stageid="ad11b76a-cf85-49ff-b8e4-cba240d9fbd8" name="InStr([Text]; "SyncProgressState: 8194") > 0" type="Decision"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><loginhibit /><display x="195" y="315" /><decision expression="InStr([Text], "SyncProgressState: 8194") > 0" /><ontrue>dfaef41f-c4c2-4e9f-9835-547d090f8ae0</ontrue><onfalse>242d0867-a9b9-45c5-b953-d0e7dfc59fdb</onfalse></stage><stage stageid="b2e609a6-6929-4c7d-862d-e1259dab5ba1" name="Exception Not Sync" type="Exception"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><display x="195" y="435" /><breakpoint type="0"><condition></condition></breakpoint><exception localized="yes" type="System Exception" detail=""OneDrive in Not Sync Status"" /></stage><stage stageid="242d0867-a9b9-45c5-b953-d0e7dfc59fdb" name="InStr([Text], "SyncProgressState: 1854") > 0 OR InStr([Text], "SyncProgressState: 2616") > 0" type="Decision"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><loginhibit /><display x="285" y="315" /><breakpoint type="0"><condition></condition></breakpoint><decision expression="InStr([Text], "SyncProgressState: 1854") > 0 OR InStr([Text], "SyncProgressState: 2616") > 0" /><ontrue>0a3737ee-8c6a-4a82-9ce1-708c6c18cbc0</ontrue><onfalse>fecd6924-99ff-413c-b9a5-5302a245a1b5</onfalse></stage><stage stageid="d317f395-5911-4b00-be44-e869cc3ec1ca" name="Exception Problem Sync" type="Exception"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><display x="285" y="435" /><breakpoint type="0"><condition></condition></breakpoint><exception localized="yes" type="System Exception" detail=""OneDrive Problem With Sync"" /></stage><stage stageid="fecd6924-99ff-413c-b9a5-5302a245a1b5" name="[Retry] < 150" type="Decision"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><loginhibit /><display x="285" y="255" /><decision expression="[Retry] < 150" /><ontrue>0bce37c8-3dc6-4b4e-9a9e-423f9b647217</ontrue><onfalse>fe848a7d-971e-4054-8cd9-cd268efc6947</onfalse></stage><stage stageid="78c28f7c-1a4f-42b4-b4f9-cede5e61c160" name="Generic Exception" type="Exception"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><display x="465" y="255" /><breakpoint type="0"><condition></condition></breakpoint><exception localized="yes" type="System Exception" detail=""OneDrive Generic Error"" /></stage><stage stageid="c2bd6f97-6021-4667-b6c7-6b9c03fd5269" name="StartOneDrive" type="Data"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><loginhibit /><display x="-150" y="-60" /><datatype>text</datatype><initialvalue xml:space="preserve">"C:\Program Files\Microsoft OneDrive\OneDrive.exe" /sync</initialvalue><private /><alwaysinit /></stage><stage stageid="89ab2a49-fda5-435f-ad6a-ef5278e5d07e" name="Utility - File Management::Append to Text File" type="Action"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><loginhibit onsuccess="true" /><display x="15" y="15" /><inputs><input type="text" name="File Name" friendlyname="File Name" narrative="The full path of the text file to append to" expr="[PathBat]&[BAT START file name]" /><input type="text" name="Text" friendlyname="Text" narrative="The text to append to the file" expr=""Taskkill /IM OneDrive.exe /F"" /></inputs><outputs><output type="flag" name="Success" friendlyname="Success" narrative="True if successful" stage="" /><output type="text" name="Message" friendlyname="Message" narrative="An error message if unsuccessful" stage="" /></outputs><onsuccess>fdbb4a00-2985-4d73-9e54-a289a82ede9a</onsuccess><resource object="Utility - File Management" action="Append to Text File" /></stage><stage stageid="c6a6b8b6-a279-4b5b-895a-6d563a4de84d" name="BAT START file name" type="Data"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><loginhibit onsuccess="true" /><display x="-90" y="-60" /><datatype>text</datatype><initialvalue xml:space="preserve">forcesync.bat</initialvalue><private /><alwaysinit /></stage><stage stageid="d2dcc049-8851-4bda-b3ca-deabb0037373" name="Utility - File Management::Delete File" type="Action"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><loginhibit onsuccess="true" /><display x="15" y="-165" /><inputs><input type="text" name="File Name" friendlyname="File Name" narrative="The full path to the file to delete" expr="[PathBat]&[BAT START file name]" /></inputs><outputs><output type="flag" name="Success" friendlyname="Success" narrative="True if successful" stage="" /><output type="text" name="Message" friendlyname="Message" narrative="An error message if unsuccessful" stage="" /></outputs><onsuccess>da1c01c9-650d-4142-9ba3-2715680a15a9</onsuccess><resource object="Utility - File Management" action="Delete File" /></stage><stage stageid="25b082c7-d7c9-4efc-9df4-53ba0ef9480a" name="PathBat" type="Data"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><display x="-150" y="-15" /><datatype>text</datatype><initialvalue /><private /><alwaysinit /></stage><stage stageid="fdbb4a00-2985-4d73-9e54-a289a82ede9a" name="Utility - File Management::Append to Text File" type="Action"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><loginhibit onsuccess="true" /><display x="15" y="75" /><inputs><input type="text" name="File Name" friendlyname="File Name" narrative="The full path of the text file to append to" expr="[PathBat]&[BAT START file name]" /><input type="text" name="Text" friendlyname="Text" narrative="The text to append to the file" expr="[StartOneDrive]" /></inputs><outputs><output type="flag" name="Success" friendlyname="Success" narrative="True if successful" stage="" /><output type="text" name="Message" friendlyname="Message" narrative="An error message if unsuccessful" stage="" /></outputs><onsuccess>0ca8b4bf-8446-4bdb-a315-1058b645bb95</onsuccess><resource object="Utility - File Management" action="Append to Text File" /></stage><stage stageid="44022675-e637-4099-b626-756956cfbdba" name="Run Command" type="Action"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><loginhibit onsuccess="true" /><display x="15" y="195" /><inputs><input type="text" name="Application" narrative="The application or short cut to start" expr="[PathBat]&[BAT START file name]" /><input type="text" name="Arguments" narrative="Any arguments needed for the app" expr="" /></inputs><onsuccess>8b01f28a-8a0e-4cb4-bafc-09d6b2703832</onsuccess><resource object="Utility - Environment" action="Start Process" /></stage><stage stageid="54c2abb6-20ea-474f-b9f5-6ea9c96c84d2" name="User Name" type="Data"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><display x="-90" y="-150" /><datatype>text</datatype><initialvalue /><private /><alwaysinit /></stage><stage stageid="0ca8b4bf-8446-4bdb-a315-1058b645bb95" name="Utility - File Management::Append to Text File" type="Action"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><loginhibit onsuccess="true" /><display x="15" y="135" /><inputs><input type="text" name="File Name" friendlyname="File Name" narrative="The full path of the text file to append to" expr="[PathBat]&[BAT START file name]" /><input type="text" name="Text" friendlyname="Text" narrative="The text to append to the file" expr=""exit"" /></inputs><outputs><output type="flag" name="Success" friendlyname="Success" narrative="True if successful" stage="" /><output type="text" name="Message" friendlyname="Message" narrative="An error message if unsuccessful" stage="" /></outputs><onsuccess>44022675-e637-4099-b626-756956cfbdba</onsuccess><resource object="Utility - File Management" action="Append to Text File" /></stage><stage stageid="02864d7d-50aa-4829-93e6-7ae7ddcaaaee" name="Utility - File Management::Delete File" type="Action"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><loginhibit onsuccess="true" /><display x="15" y="375" /><inputs><input type="text" name="File Name" friendlyname="File Name" narrative="The full path to the file to delete" expr="[PathBat]&[BAT START file name]" /></inputs><outputs><output type="flag" name="Success" friendlyname="Success" narrative="True if successful" stage="" /><output type="text" name="Message" friendlyname="Message" narrative="An error message if unsuccessful" stage="" /></outputs><onsuccess>187c59fe-b217-410f-83f8-08e976c56d10</onsuccess><resource object="Utility - File Management" action="Delete File" /></stage><stage stageid="fe848a7d-971e-4054-8cd9-cd268efc6947" name="Utility - File Management::Delete File" type="Action"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><loginhibit onsuccess="true" /><display x="375" y="255" /><inputs><input type="text" name="File Name" friendlyname="File Name" narrative="The full path to the file to delete" expr="[PathBat]&[BAT START file name]" /></inputs><outputs><output type="flag" name="Success" friendlyname="Success" narrative="True if successful" stage="" /><output type="text" name="Message" friendlyname="Message" narrative="An error message if unsuccessful" stage="" /></outputs><onsuccess>78c28f7c-1a4f-42b4-b4f9-cede5e61c160</onsuccess><resource object="Utility - File Management" action="Delete File" /></stage><stage stageid="0a3737ee-8c6a-4a82-9ce1-708c6c18cbc0" name="Utility - File Management::Delete File" type="Action"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><loginhibit onsuccess="true" /><display x="285" y="375" /><inputs><input type="text" name="File Name" friendlyname="File Name" narrative="The full path to the file to delete" expr="[PathBat]&[BAT START file name]" /></inputs><outputs><output type="flag" name="Success" friendlyname="Success" narrative="True if successful" stage="" /><output type="text" name="Message" friendlyname="Message" narrative="An error message if unsuccessful" stage="" /></outputs><onsuccess>d317f395-5911-4b00-be44-e869cc3ec1ca</onsuccess><resource object="Utility - File Management" action="Delete File" /></stage><stage stageid="dfaef41f-c4c2-4e9f-9835-547d090f8ae0" name="Utility - File Management::Delete File" type="Action"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><loginhibit onsuccess="true" /><display x="195" y="375" /><inputs><input type="text" name="File Name" friendlyname="File Name" narrative="The full path to the file to delete" expr="[PathBat]&[BAT START file name]" /></inputs><outputs><output type="flag" name="Success" friendlyname="Success" narrative="True if successful" stage="" /><output type="text" name="Message" friendlyname="Message" narrative="An error message if unsuccessful" stage="" /></outputs><onsuccess>b2e609a6-6929-4c7d-862d-e1259dab5ba1</onsuccess><resource object="Utility - File Management" action="Delete File" /></stage><stage stageid="ea413de1-fa98-47a5-b23d-582b3a5fdb7a" name="Utility - File Management::Delete File" type="Action"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><loginhibit onsuccess="true" /><display x="105" y="375" /><inputs><input type="text" name="File Name" friendlyname="File Name" narrative="The full path to the file to delete" expr="[PathBat]&[BAT START file name]" /></inputs><outputs><output type="flag" name="Success" friendlyname="Success" narrative="True if successful" stage="" /><output type="text" name="Message" friendlyname="Message" narrative="An error message if unsuccessful" stage="" /></outputs><onsuccess>bf19237b-8b8c-478c-99ab-af37ae54a909</onsuccess><resource object="Utility - File Management" action="Delete File" /></stage><stage stageid="dfd56d09-1dfb-442c-93a6-1cba0c78505f" name="Input" type="Block"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><loginhibit onsuccess="true" /><display x="-195" y="-255" w="150" h="60" /><font family="Segoe UI" size="10" style="Regular" color="7FB2E5" /></stage><stage stageid="5853169a-eaf4-4137-be78-9003c3abeeae" name="Local" type="Block"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><loginhibit onsuccess="true" /><display x="-195" y="-180" w="150" h="240" /><font family="Segoe UI" size="10" style="Regular" color="FFFF00" /></stage><stage stageid="c844ded0-4893-4ffb-8145-288edbe0497c" name="Output" type="Block"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><loginhibit onsuccess="true" /><display x="-195" y="75" w="150" h="60" /><font family="Segoe UI" size="10" style="Regular" color="FF00FF" /></stage><stage stageid="f4473988-9276-4ac9-a759-ada98f9b8aad" name="VBO - Team Utility::Create BP AppData Path" type="Action"><subsheetid>a768a89c-1674-4402-a97a-0f71f05c75e2</subsheetid><loginhibit onsuccess="true" /><display x="15" y="-240" /><outputs><output type="text" name="pathAppDataBP" friendlyname="pathAppDataBP" stage="PathBat" /></outputs><onsuccess>d2dcc049-8851-4bda-b3ca-deabb0037373</onsuccess><resource object="VBO - Team Utility" action="Create BP AppData Path" /></stage></process>
Copy and paste this block in a new object and import a new namespace System.Environment in intialize page and use Visual Basic language. Below you can find the logic for the sync action. In this case we have a response when we launch the script:
SyncProgressState: 65536 (Sync is in Pause)
SyncProgressState: 8194 (OneDrive in Not Sync Status)
SyncProgressState: 1854 or SyncProgressState: 2616 (OneDrive Problem With Sync)
Instead if you have SyncProgressState: 16777216 or SyncProgressState: 0 sync was done correctly.
Here you can find the code related to "VBO - Team Utility" action "Create BP AppData Path":
<process name="__selection__VBO - Team Utility" type="object" runmode="Exclusive"><stage stageid="555d440b-a6ae-4fc9-a63e-d01bb4a9f3cc" name="Create AppData Path" type="Code"><subsheetid>b4c2fe07-a7cf-423b-80f8-78719fcf5275</subsheetid><loginhibit /><display x="-120" y="-45" /><outputs><output type="text" name="pathAppDataBP" stage="pathAppDataBP" /></outputs><code><![CDATA[Environment.CurrentDirectory = Environment.GetEnvironmentVariable("appdata")
Dim info As DirectoryInfo = new DirectoryInfo(".")
pathAppDataBP = info.FullName + "\Blue Prism Limited\Automate V3\"]]></code></stage><stage stageid="979035df-8860-4b16-8e45-61dd5858c1b0" name="LOCAL" type="Block"><subsheetid>b4c2fe07-a7cf-423b-80f8-78719fcf5275</subsheetid><loginhibit /><display x="-525" y="-45" /><font family="Segoe UI" size="10" style="Regular" color="FFFF00" /></stage><stage stageid="8b374641-bed9-4189-aa37-4389742dca09" name="INPUT" type="Block"><subsheetid>b4c2fe07-a7cf-423b-80f8-78719fcf5275</subsheetid><loginhibit /><display x="-435" y="-45" /><font family="Segoe UI" size="10" style="Regular" color="7FB2E5" /></stage><stage stageid="73675908-a823-4af8-9d18-a6e67cdac09f" name="OUTPUT" type="Block"><subsheetid>b4c2fe07-a7cf-423b-80f8-78719fcf5275</subsheetid><loginhibit /><display x="-345" y="-45" /><font family="Segoe UI" size="10" style="Regular" color="FF00FF" /></stage><stage stageid="2c989ecf-384f-4416-b5f5-da24e263b6bc" name="pathAppDataBP" type="Data"><subsheetid>b4c2fe07-a7cf-423b-80f8-78719fcf5275</subsheetid><display x="-315" y="-75" /><datatype>text</datatype><initialvalue /><private /><alwaysinit /></stage></process>
I hope this is helpful to you.
Simone