Get Latest File in Sharepoint Online

Hi,

I would like to pull the latest file from Sharepoint Online. I tried to use this in assign activity Directory.GetFiles(ArgAscentPath).OrderByDescending(Function (f) New FileInfo(f).CreationTime).ToList(0).ToString but I wasn’t unable to retrieve the file.

ArgAscentPath = “\\\*.sharepoint.com\\sites\*\\Tools and Technology\\Participation Audit\\Testing\*****\\” stored as JSON.

Does anyone successfully run this type of procedure?

Thank you in advance!

Hi @marlon110886 ,

Please use something similar for your ArgAscentPath assign:

I’ve tested the solution. It is working for me.

Ppay attention that in order to access the Sharepoint you should have ...\DavWWWRoot\... syntax. Please check .net - What is DavWWWRoot? - Stack Overflow for more details

Best regards,
Marius

Hi @Marius_Puscasu ,

have you already accessed the location before you execute this in UIPath?
As the procedure works for me if I already accessed the location in IE but when I reboot the pc and access it from start the code doesn’t work.

Thank you!

Hi @marlon110886 ,

After PC reboot, if you have never accessed the location, then it is necessary to enter the SharePoint credentials (security reason).
In my procedure, I’ve added a sequence to login to SharePoint. I suppose that you have to login as well, in order to be able to access the SharePoint location after a reboot.

Best regads,
Marius

Hi @Marius_Puscasu , Can I see your procedure for logging in Sharepoint Online? Thank you!

Hi @marlon110886 ,

As I said, the login part is just a simple sequence to enter the credential whenever the Windows Security popup window comes into view. I’m using SharePoint Foundation Server 2013.

However, for Sharepoint Online please take a look over the following custom activity https://marketplace.uipath.com/listings/sharepoint-custom-activities-package

It might help you
Best regards,
Marius

Hi @Marius_Puscasu ,

Thank you very much! I will try this one.

Regards,
Marlon