How to retrieve path of file from sharepoint site?

Hi Guys,

Our requirement is as below:
In a library, n number of folders/sub folders can be there. So we want to filter that library first on value of a column. Once that is done, it will show list of all files(from folder/sub-folders).

Now we want to download all the files that are shown after filtering.

Is there a way, we can also retrieve the file path on sharepoint with the file?

Regards
Sonali

Hi @sonaliaggarwal47,

We have previously used this approach.

Manually: You can try opening the SharePoint folder via windows explorer. This will for the given session map the SharePoint folder as a network drive (will ask for authentication before mapping the drive).

Later we used custom C# code to download the files in the folder using the Fullpath (which is a URL). We used C# because Directory.GetFiles does not support URL based Mapped drive locations/paths.

Programatically: You can also use net use command in cmd or PowerShell to map network drives / SharePoint folders programatically. More info on Net use Net use | Microsoft Docs

Net use can help shorten the URL path by mapping to the Nth parent folder of the file but still the FullPath to your file will be read as a Network Drive.

Network drives dont gel so well with UiPath (I read in some release post that UiPath will support network drive file downloads) so until then I would suggest you build up a reusable C# library which can download/delete/copy/move files in a network drive.
You can start here : WebClient.DownloadFile Method (System.Net) | Microsoft Docs