When files are transferred to a directory that Onedrive has been set to be in sync with, the files get pushed to Onedrive either immediately or after a few seconds.
When a robot’s final step involves pushing a file to that particular directory, the sync remains incomplete since the robot directly terminates the session as it has reached the end of what is was programmed to perform.
I’d like to know if its possible to apply a condition where the robot keeps the session active as long as the sync takes place. Right now we are using parameterized delays but sometimes the files can be 40-50MB and a delay is not exactly the best approach as that would involve the use of massive delays.
Unfortunately the client cannot provide API details due to their company policies so we have to look for an alternative like maybe a custom VB.Net or C# code that could check if OneDrive is syncing files.
Help would be most appreciated, thanks in advance.
You are welcome. Here’s code in VB.NET that you can use with Invoke Code. It’s slower than the Powershell script since it uses reflection.
InArgument: in_FolderPath
OutArgument: out_Status
Dim shellType = Type.GetTypeFromProgID("Shell.Application")
Dim shell = Activator.CreateInstance(shellType)
Dim folder = shellType.InvokeMember("Namespace", Reflection.BindingFlags.InvokeMethod, Nothing, shell, New Object() {Path.GetDirectoryName(in_FolderPath)})
Dim status = shellType.InvokeMember("GetDetailsOf", Reflection.BindingFlags.InvokeMethod, Nothing, folder, New Object() {shellType.InvokeMember("ParseName", Reflection.BindingFlags.InvokeMethod, Nothing, folder, New Object() {Path.GetFileName(in_FolderPath)}), 303})
out_Status = status.ToString