SharePoint Upload Files missing Destination Folder only when unattended

Hi all, I have a fairly unique situation that I have not been able to find in the forums already.

We have setup a OneDrive & SharePoint connector with a service account. We have validated the service account has the necessary rights to the SharePoint site. The workflow starts with a Get file or folder list then does a For Each of currentO365DriveRemoteItem to check if a matching folder exists, if it does we save currentO365DriveRemoteItem.Url to a FolderURL string. If it does not exist we are using a Create Folder activity then subsequently saving the Folder(out) and then assigning FolderOut.Url to the FolderURL string.

Then finally in a for each file we are uploading LocalResource.FromPath(CurrentFile.FullName.toString) to the File or folder Url using the FolderURL extracted during the first sequence.

The issue that we are having is that on a local development machine when running in debug from Studio it works flawless. Both scenario of FolderExists it properly assigns the Url to the string variable and uploads the files to the proper folder then sends an email with the FolderURL string in the body.

Once we publish it to Orchestrator and run it (either manually, or with a queue trigger) the process mostly works, creating the new folder (if applicable) works, the FolderURL variable works (confirmed by the confirmation email). HOWEVER, the files get uploaded one folder level above (in the root) - Example Site/Documents/ParentFolder/TargetFolder - the variable shows the full URL to the TargetFolder, but the files are being uploaded to the ParentFolder.

Same exact code when we run it in Debug the files land in the TargetFolder. The issue is ONLY occuring when running it from orchestrator with an unattended robot (on multiple VM’s)

I’m stumped, any thoughts?

@dark

Can you log the folder url just before the uplod to check if by chance anything is truncated

Cheers

Thanks for the reply!

Yep, that’s the strangest thing, I added an info log just before the upload files activity with the FolderURL string and it is logging the full path just before entering the upload activity (both when doing local debug and watching logs in orchestrator). :frowning:

@dark

Can you show some screenshots here

Cheers

Hi Anil,

Here is a snip, I did redact a few immaterial items. This shows the initial sequence.

1 Like

Would only let me do one image at a time with this new account.

This one shows two attempts of the upload (one uses the FolderURL string, the other uses the O365DriveRemoteItem from the create new folder. We’ve mix/matched them and no matter if we use the URL string or the DriveRemoteItem it will only put the files into the parent folder and only while unattended lol

The problem may be related to the difference in environment between your local computer and the Orchestrator servers. Make sure that the file and folder path configuration in your code matches the expected SharePoint site structure. Check that you are using the correct path separators (for example, "" for Windows and “/” for URL) and that the path to the target folder is well formed.

Hi, have you solved this one? I am kind of in the same situation. The code works fine in dev, but when in prod the file is not getting uploaded into sharepoint folder, which was created in the process above within the same flow.