Skip to main content
Community site session details

Community site session details

Session Id : uLrzzKDUPakX7pVJfoTbAw
Power Automate - Building Flows
Answered

Specify folder/subfolder in environment variable

Like (0) ShareShare
ReportReport
Posted on 8 Mar 2024 13:27:38 by

I am new to building flows within Solutions, so I could need som help with how best to use environment variables. I am creating a flow which moves a file from one folder to another within the same site.

So far I have been able to create EVs for both the Site and the Library. Is there any way to create an EV to specify which folder it should move to? (See image: now "/Documents/FolderName")

And if this is not possible, what is best practise? Do you just have to manually enter the folder when moving the Solution to another environment?

I appreciate any help, 
Thank you!

Karinabr_0-1709904239091.png

 

  • Community Power Platform Member Profile Picture
    on 19 Mar 2024 at 10:47:37
    Re: Specify folder/subfolder in environment variable

    Hi @sdedic,

    I guess it depends on what your trigger is. But in my case I am using a Sharepoint trigger "When a file is created". In the actions following you can directly choose the file identifier from this file from the dynamic content menu. You can search for "identifier" if you have english set as language. (See images)

    This only works I guess, if you both have a trigger that relates to a specific file, and that it is this file you are trying to access. 

    Karinabr_0-1710844904960.png

    Karinabr_1-1710845023411.png

     



  • ar87 Profile Picture
    353 on 12 Mar 2024 at 08:10:56
    Re: Specify folder/subfolder in environment variable

    Hi @Anonymous,

     

    Thank you for your help. Unfortunately, I got the same error when tried entering the path without first '/'.

     

    I think I didn't understand quite well your first scenario, where you say I don't need env variable. Could you please explain it a bit more?

     

    Anyhow, I am using env variables as I am importing a solution do a different environment and mapping them to production lists. Hope this provides a bit more context why I need env variables.

     

    Once again, thnx for the help.

    Best

  • Community Power Platform Member Profile Picture
    on 11 Mar 2024 at 11:47:19
    Re: Specify folder/subfolder in environment variable

    Hi, @sdedic 

    When I am choosing File identifier I always use it relative to one of the files in the flow, so I would just use 

    triggerBody()?['{Identifier}'] or similar. In this case I don't think you need to use environment variable as it should already update dynamically. Would this work in your case?

    If not try this:
    When looking at the path provided using this 
    triggerBody()?['{Identifier}'] command I noticed the the path is on the format "Shared documents/Folder/file.pdf" and not "/Shared documents/Folder/file.pdf" as it seems is what you set as your variable. Maybe try to test without the "/" in the beginning?

    Let me know how it goes.




  • Community Power Platform Member Profile Picture
    on 11 Mar 2024 at 11:29:39
    Re: Specify folder/subfolder in environment variable

    This worked for me! 

    I was hoping there was an option to chose from dropdown menu of existing folders like you can for sites and libraries, to reduce possibilities for manual mistakes.. But this will do. Thank you 🙂

  • ar87 Profile Picture
    353 on 11 Mar 2024 at 09:24:17
    Re: Specify folder/subfolder in environment variable

    Hi @Tristan_D,

     

    I've tried your idea, however I am getting an error. Please see the screenshot below to get more context:

    sdedic_0-1710148934790.png

     

    Here is the action in edit mode to confirm that environment variable is there:

    sdedic_1-1710148980719.png

     

    Any idea why throwing such error when the path is exactly the same as when I select it through the 'folder' icon?

     

    Best

  • Verified answer
    Tristan_D Profile Picture
    388 on 08 Mar 2024 at 13:47:21
    Re: Specify folder/subfolder in environment variable

    Hi @Anonymous ,

     

    I would suggest you to use a text Environment variable :

    Tristan_D_0-1709905588923.png

     

    You can also consider concatenate two Environment Variables to build your folder/sub folders chain.

    Tristan_D_1-1709905840174.png

     



    Let me know if it helps.

    T

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

Announcing our 2025 Season 2 Super Users!

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2

Loading complete