How to download files and find path from multiple subfolders in SharePoint using 0365 Activities

Hi Guys,

Can you help me to download or navigate and get name of the file in Sharepoint using Microsoft 0365 sharepoint activity.

I have a sharepoint list say sharepoint Site url and fixed folder but inside that there are multiple as well as multilevel subfolders which names are not fixed.

for example

  1. SiteURL\Fixed subfolders1\Fixed subfolders2\Not fixed subfolders\Not fixed subfolder\file (inside fixed folder there is a folder and inside that folder there is a subfolder and then file

  2. SiteURL\Fixed subfolders1\Fixed subfolders2\Not fixed subfolders,Not fixed subfolder\file (two not fixed subfolders inside a fixed folder name)

Using find folders activity I am able to get all folders in fixed folders like for example in above 1. Not fixed subfolder 2. Not fixed subfolders,Not fixed subfolder

Can’t use find folder inside find folders because its multilevel structure folders.

I want to have the whole absolute path and relative path of the file and folders.

Thankyou

@Akshay_Suryawanshi

You can use for each file /folder to get eaxh subfolder… then navigate inside…

You can use finf files as well in loop…after find files…driveitem.Name eill give thw name of current folder oe file and from
There you can add this new value to already existing value…and then use find files as needed

You can use file and folder properties to find if it is folder or file and then i beleive remaining dependa on the folder structure you have

Hope this helps

Cheers

Hi Thanks for your help

but I can’t use find folders activity under another find and folder for each
because the level of subfolders are not fixed for example
for on it can be sometimes fixed folder\subfolder level 1\subfolder level 2\subfolder level 3\subfolder level 4\file.

example 2.

fixed folders\subfolder level 1\file.

I don’t know till when I have to use find folders to navigate through the folders.

@Akshay_Suryawanshi

You can use for each file /folder with sub folders checked…

If you want to use find folders then use loop till yoi find a file…then you can the value of all the folders plus subfolders list with you…the loop ends when you get a file

Cheers

Hi Ani,

I have tried with this property but its returns the folder’s only till the first folders not till the files

@Akshay_Suryawanshi

Try with the second methos of using find files in loop…basically whatever name that you get you have to add the sub folder again till you get to a file

Cheers

Hi,

As I have stated earlier too. I cannot keep looping find folders activity. there is no fixed subfolders. how can I set predefined activity for undefined subfolders.

@Akshay_Suryawanshi

To give you an idea here is the workflow…you need not know how many are there before…As of now I created a loop to check the first returned value always…but we can include logic to get and save each folder and then use them as needed

da_FoldersAndFiles is the output of find files…you can leave the query blank or give any generic search but sub folder will change as the new sub folder is identified

The loop continues till a file is found…

Hope now it is clear

cheers

Hi,

I am trying the same logic but it returns only folder of first level. there are folders and files inside these folders as well.

example.

ACT ll
→ MW1 AND CC2
→ MW
→ File.docx
but you can see the screenshot in which only ACT ll folder is returned and not folders and file inside it

@Akshay_Suryawanshi

This while loop if you see is having a condition…to loop and append the folders from there…this is how we use as well. That is one reason i am confident we cna do it this way…

Did you append the sub folder value to the orginal folder location…as i did at last in the else condition?

Cna you show your flow please

Cheers

Hi Anil

can you check the logic you have sent? Its assumed to be only for one folder and on subfolders only and it doesn’t meet the requirement when there are are multiple folders and causing issue when looping on driveitem

@Akshay_Suryawanshi

I hope you checked this line…

I gave you by checking only first result…

Additional logic needs to be implemented for all the folders apart from first… which needs to be included…

You need to create a kind of recurssive function

You can store all the returned values into excel or array and then let the loop continue as you need…those are additional logics as per need

Cheers