Unable to upload file to sharepoint

I am trying to upload a file to sharepoint, the file exist in the folder, and the upload process works when it is an excel but NOT if the file name is a PDF. I get a studio error that the file is not found

Hi @Nathan_Betters1
Can you check if there’s a space at the end of the name of the file?

Shouldn’t be it’s provided by input variable that

Try to debug the process and before uploading the file in to the sharepoint check the variable value in the immediate panel or watch panel.
There will be issues with your file path.

Regards

Sreejith S S

Hi @Nathan_Betters1

Can you check the path showed in the error whether any file is available there , the screenshot of the file has a different path than in the error path so kindly check there

You can also try like this
if File.Exists(“Path in the error + file.pdf”)
True - upload file
False - Copy file from one drive folder to the path showed in the error and then upload file

Hope this helps

Regards
Sudharsan

I found the issue but I don’t know how to fix it…
I am using the Environment.ExpandEnvironmentVariables(“%USERPROFILE%\Downloads”) but its returning a “C:” drive as the root not the D drive… so when the robot tries to upload the file its not finding it…