Loop all the folders and sub folders in sharepoint

2024-11-04T05:07:43.38+00:00

how we can get Loop all the folders and sub folders in share point

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
11,229 questions
Microsoft Power Platform Training
Microsoft Power Platform Training
Microsoft Power Platform: An integrated set of Microsoft business intelligence services.Training: Instruction to develop new skills.
619 questions
{count} votes

Accepted answer
  1. Syed Saleem Peera 12,745 Reputation points Microsoft External Staff Moderator
    2024-11-04T07:07:46.6533333+00:00

    Hi EXTERNAL Eswaraiah Devara (Apexon, SO/OPM26-IN),

    Thank you for reaching out to us on the Microsoft Q&A forum.

    To loop through all folders and subfolders in SharePoint, you can use Power Automate (formerly known as Microsoft Flow). Here’s a step-by-step approach:

    Step-by-Step Points

    Set Up Flow:

    Go to Power Automate > Create > Automated Flow.

    Choose a trigger (e.g., When an item is created or When a file is created).

    Get Folder Metadata:

    Add the Get Folder Metadata action.

    Set it to the root folder in the desired document library.

    List Folder:

    Add the List Folder action.

    Configure it with your site address and the folder path.

    Loop Through Items:

    Add an Apply to Each action using the output from the List Folder.

    Inside this loop, add a Condition to check if the item is a folder.

    Recursive Action:

    If true (it's a folder), call List Folder again for the folder’s path.

    Process Data:

    Log or process folder and subfolder paths as needed (e.g., send emails, store in a database).

    Kindly refer to the screenshots below.

    Kindly refer to the screenshots below.User's image

    User's image

    If you found the information helpful, we would greatly appreciate it if you could acknowledge it by selecting the Accept Answer & Upvote options.

    Thank you.

    2 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. PRAVIN SHASTRAKAR (iDEAS-AEM) 1 Reputation point
    2024-11-04T05:24:12.19+00:00
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.