I have a SharePoint URL and fixed subfolders path. But inside the subfolders there are multiple files and folders. I have to download all files inside the folders. I dont care about the folders and subfolders the files are available in.
I am using find and folders activity but it gives me folders till Sharepoint URL not inside the folders.
even cant use for each files and folders it doesn’t allow secretID and applicationID. and also doesnt allow subfolders path
You have to use find files or folders inside loop…
Say your structure is as follow folder1/folder2/folder3/folder4(files and folders)/Subfolder(files and folders)/files
Now first use sub folder as folder1/folder2/folder3 and search folder 4…And now loop through drive items…if a file is found then download it…if folder is found then use find files/fodler and now the sub folder would be folder1/folder2/folder3 + “/” + Currentitem.Name …like this you can loop through each folder …
For this you have to create a separate find files to use it recursively
I tried to get the first subfolder using find folders and looped the driveitem using for each
and inside the for each checked if the item is file if not than in while loop add another find and folders to get drive item the subfolder2 and loop until the file is found but to do so we need to re-read the find folders and it goes on adding drive item.
I guess there is some conditional issue in my code. can you please provide me a working workflow to not get stuck loop through all files?
Thanks for the solution. the solution is actually working if there is Subfolder1/subfolder 2/all files. but if its Subfolder1/subfolder 11 and subfolder 12 / and in it subfolder there is all files and subfolder 12/subfolder 13/all files. do you have any idea why is it not working for the mentioned subfolders structure.
Try running in debug and check what is missing…it should work…its been a while that i used this logic …I recreated it just as prototype…when running in debug make sure to check the variables continuously ans did you check the isolated check box in the invoke workflow?
I currently dont have sp access right now…will try to check from myside as well…would suggest run in debug and procide more info …can add more conditions or so…
actually its working only when its subfolders and inside that there are files. so its only executing then at this condition.
only when there are subfolders inside subfolder its not actually searching inside the subfolders.
The logic is working fine. I guess its the query where we add driveitem.name its not working for 2nd folders but its working for first. for example I have test folders and inside it I have test2 and test3 folders.
I am able to loop through test2 and test3 folders. now suppose in test3 folders there are all files than it works but in test2 there are more subfolders like test23 and test22 inside test2 folders . the drive item only returns test2 folder but it loops two times but not files