web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : ds1Sm7FAzkNxeZFGEve/T9
Power Automate - General Discussion
Unanswered

Variable as Folder Path

Like (0) ShareShare
ReportReport
Posted on 21 Jul 2023 16:48:44 by 2

Basically I have a lot of units in a project I am working on and want to create a SharePoint folder for each one named after each project. The Path argument of "create new SharePoint folder" doesn't seem to recognize variables as dynamic arguments so I've tried passing the data in through a .json file and the compose action but my flow keeps getting stuck in the apply to each function at the end.

Running the program without the create folder action shows that the values  I want to use to name the folders as are coming out of Compose 3 just fine. So it's something with the create folder hanging everything up.

 

Is it possible to pass in a variable as the the Path argument when creating a new SharePoint folder? Or is there a reason I'm missing as to why the apply to each is getting stuck?

  • S-Venkadesh Profile Picture
    645 Moderator on 22 Jul 2023 at 21:46:41
    Re: Variable as Folder Path

    Hi @jsbmk ,
    I have replicated the issue you mentioned and here are the steps and details of what worked for me:

    SVenkadesh_0-1690062287262.png

    I hope this information is helpful. If it is, please consider giving a thumbs up.

     

    Best regards,

    Venkadesh Sundaramurthy

  • David_MA Profile Picture
    11,938 Super User 2025 Season 2 on 21 Jul 2023 at 18:12:54
    Re: Variable as Folder Path

    What you are generating cannot be used as a folder path. It contains invalid characters and line returns that are not allowed. A folder path would be something like.

     

    /documents/expenses/reports

  • jsbmk Profile Picture
    2 on 21 Jul 2023 at 18:03:52
    Re: Variable as Folder Path

    Oops. Here's what I have currently:

     

    Compose 1: base64(outputs('Get_file_content_using_path')?['body'])
    Compose 2: base64ToString(outputs('Compose'))
     
    The first two composes are used to get the json data from my file. The data is then parsed into the format: 
    [
      {
        "UnitNumbers""Fxxxxxx1 "
      },
      {
        "UnitNumbers""Fxxxxxx2 "
      },
      ...
      ]
     
    Then attached is what I have inside the apply to each loop
  • David_MA Profile Picture
    11,938 Super User 2025 Season 2 on 21 Jul 2023 at 17:28:00
    Re: Variable as Folder Path

    Since you don't show what you are actually composing in the Compose actions, it is hard to tell what the problem may be. However, this has worked for me without any issues:

    folderpath.jpg

    In the Create file action, select the root level folder where you want the subfolders created. Then be sure that your variable data path begins with a backslash as shown above in the Compose Folder Name action. Don't confuse it with the Compose Folder Path action. That one creates the link to the folder that I use in an e-mail action later on. 

     

    My naming convention is the current year and the ID of a forms submission padded with zeros. It results in folders named like:

    David_MA_0-1689960445359.png

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 986 Moderator

#2
stampcoin Profile Picture

stampcoin 699 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 577 Super User 2025 Season 2

Loading complete