Finding recent file and copying it to sharepoint


My robot downloads a file from web. I want to find this recent file and download it to sharepoint. Sharepoint download I can do if I know the name of the file. I found Sarathis advice about how to do it. I copied it and found my recent file, but how to to combine recent file and upload to sharepoint? Pleae help thank you.

sarathi125Robot Master

Aug '18


Check this workflow, this will give you the recently modified from a particular directory, change the directory path in the variable section.

Main.xaml (5.4 KB)

Check this link to get creation date of the files, not the modified date.

@Anni_K - sorry, not sure what you mean by combine, but to upload, you can use Upload Activity.

More details here: How to Upload File to Sharepoint? - #2 by lakshman

1 Like

Okay, let me try put it here step by step.

I download a file from web. In my example it was Gant sheet excel. (“C:\Users\Anni\Downloads\Gantt sheet.xlsx”)

Let’s pretend I don’t know where it got saved. I want to pick up my latest excel save.


Here, this sequence seems to work. Execution started, Gantt sheet got found and execution ended.

The other thing I try to do is upload a file to Sharepoint. I can upload the file to sharepoint if I know the name and the location. See picture below:


But how to make recent file to get uploaded to sharepoint? Btw. I don’t get those variables on the topper picture… I think the answer may lay somewhere there… Thank you for your time!

Hi @Anni_K

What is the default value of the directory variable in screenshot 1?

Should the Local Path value in screenshot 2 be directory+fileNameRecent.Name? Unless I am missing something or not understanding your question correctly.

1 Like

If we can SYNC the share point to our local machine then it would be very easy
Like in share point we got an option at the top left as Sync
If we enable that option that share point folder will be included to our local machine drive
So that we can easily access the files in share point by taking that folder location from our system itself

Once after syncing
Use this expression to get the filepath of latest saved file from a folder

str_filepath = Directory.GetFiles(“yourfolderpath”).OrderByDescending(Function(a) New Fileinfo(a).CreationTime).ToList(0).ToString

Then use a normal MOVE FILE activity as we have now synced the share point as a normal folder to our local machine
Where in the activity mention the path property as str_filepath and in the destination mention the folder path of the synced share point folder

Cheers @Anni_K

1 Like

Thank you, the little robot is fully functional now. I had made one extra folder transfer which I didn’t need at all.

True it was that since I had tried all sorts of stuff I needed to make sure Directory info variable was right, then I needed to check out correct paths for local path. The mistake I made was to copy the full path like "C:\Users\Anni\Downloads" and then to hit + and have the fileNameRecent.Name -.-’

Thank you!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.