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?
Please check find files and loopfiles xamls in this…find files is the first one you would invoke
PepProcess - Copy (3).zip (10.5 KB)
Hope this helps
Note: This is a prototype match to your values and all
Hi @Anil_G ,
Thanks for the workflow, but it is throwing invalid document when trying to open the workflow in studio. So I am unable to check the code. Can you please reattach the workflow?
I tried with three different machine but still not able to access the workflow. on every machine its throwing same error. 2 m/c have same studio version and 3rd machine has different studio version.
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…
I did check in the debug mode and printed all the values.
In first loop suppose I have Siteurl\subfolder path and get the folders inside using the find and folders and invokes the loop files
so in loop files when it is looping on the results it has Siteurl\subfolder path\ drive item (subfolders)
so it is not getting the data from inside of Siteurl\subfolder path\ drive item (subfolder) so its only looping on folder not anything further of it.
so it works when there is only on subfolder because in next loop it gets files “.” match and it downloads it.
I am pretty sure its looping on the number of folders currently because its not going in infinite loop. just that not updating the subfolders path correctly.
So you are saying in loop files after downloding the file if folders are present is it not calling the invoke function in else condition at all?
Even if it downlod it still calls the else path…can you check what is going wrong on that part
Hi @Anil_G ,
On addition to it I found that when we pass subfolder name in query its actually not returning any new updated drive items.
Looks like the sub folder we are passing back is wrong or is not returning any values…can you check on that …currentsubfolder value…if it is correct…if not we need to modify it…
Log the value of that and check if thw search is giving any results
Ahh nahh…i see we have to pass a query also…to get the value…let me also check properly once again
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
Got the issue…the value passed for query is wrong…Please check the new updated code…and make changes accordingly…
Hope this helps
Thanks for the help. its working perfectly fine.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.