I am using the Download File activity in UiPath.Salesforce.Activities v1.9.3. I am getting the error “Could not find a part of the path ‘{{my_path}}’.”.
Properties are set as seen here:
I have verified that in_FildeFolder is a valid path by copying and pasting into the file explorer.
I have verified that in_FileID is the ID of an existing Attachment object in Salesforce.
I have verified the Salesforce connection by successfully using the Execute SOQL activity.
I have tried uninstalling and re-installing the Salesforce activities package. I have also tried using older versions of the package. All to no avail.
Running my workflow in Debug mode with “Log Activities” set to true, I can only see that the activity is logged as “Download File Faulted”.
I have tried everything at this stage - my only inkling left is that perhaps the error message is not relevantly detailed and that perhaps the Attachment ID is not the correct ID value to use to download the file contents.
In debug did you try opening the locals panel and check exception details from there?It might give more info
also I hope when you copied the path you did not modify it in any way…did you try printing the path using log message and check…are there extra double quotes at the start or end of the string
Looking at the exception in the locals panel, I can see this:
RemoteException wrapping System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\myusername\Documents\UiPath'. at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
I passed “C:\Users\myusername\Documents\UiPath” as the folder name and “123.pdf” as the file name. So, I presumed that the activity would concatenate these two values to make a full path of “C:\Users\myusername\Documents\UiPath\123.pdf” but instead it is just adding the trailing backslash to the folder path and passing this value as the fullPath argument in the CreateFile method which is causing the exception as "C:\Users\myusername\Documents\UiPath" is obviously not a full path. I am getting this result whether I pass a file name or not (this argument is optional in the Download File activity).
In answer to your other questions, I double checked and confirmed that the paths I am giving are valid by printing the exception message and copying and pasting the path into the file explorer. Similarly, I verified that the ID is valid in Salesforce.
At this point I am wondering is there possibly a bug with the activity itself that is causing it to incorrectly construct the download path string.
I hope myusername is replaced by you with actual username
As per exception message it is checking for directory only and it is not able to find it…so can you try a directory which doesnot contain username and use a static path for now
I was not able to find a solution for the problem with the download file activity. I tried downloading the same file using simple_salesforce in Python and was successful. This indicates that there is some problem with the Download File activity itself which is not being explained properly by the NullReferenceException that it is throwing.
Because I was able to use Python to verify that the file was, in fact, downloadable, I implemented a mechanism to download the file in UiPath using just the WebApi.Activities package. This solution includes a workflow for generating an access token using the username and password OAuth flow (though you may prefer to implement a different flow). I have attached a zip file with xamls for making an access token and downloading the file, as well as some client code to demonstrate. Please note that if you are planning to use the Salesforce activities in conjunction with the WebApi activities and you are using the Windows framework (rather than Windows legacy), you will need to downgrade the Salesforce activities package to 1.8 (from 1.9.x) as Salesforce 1.8 has a dependency on RestSharp v108 which is both not available in Windows projects and clashes with the WebApi package’s dependency on RestSharp v106. DownloadFile.zip (7.0 KB)
Just to note, for any UiPath staff members who follow these posts, this is one of many very frustrating issues I have had to debug since moving to from Windows Legacy to Windows - that paired with the unavailability of many packages (even those published by UiPath itself!) in Windows projects makes me question the wisdom of or even intention to deprecate Legacy in the foreseeable future.