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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Error using Environmen...
Power Apps
Unanswered

Error using Environment variable for SharePoint library in Cloud Flow

(1) ShareShare
ReportReport
Posted on by 96

I have a Cloud Flow that does a bunch of things, among which is to copy a set of SharePoint folders in a specific library (Baseload Document Library in the following) and then copy whatever files it finds in the source library to the target library.

 

I need to be able to move the solution between environments (both in our own tenant and eventually in a customer’s), so the target site will change. For this purpose, I’ve added two Environment variables, one for the site and one for the library. This is how I use them in the flow (both the Site and the Library env variable names start with the same characters but they are different):

Rydman_0-1650377442602.png

 

This works as expected in my dev environment. Folders are created and files are copied into my Dev SharePoint site.

 

I then export/import a managed Solution to my Test env and change the environment variable values in the Default Solution:

Rydman_1-1650377442605.png

 

 

Rydman_2-1650377442614.png

 

 

The fact that my Doc Library appears in the dropdown list when the Site is designated by my other env variable would seem promising…

 

When I run my flow, the folders get created in my Test SharePoint environment which, as far as I can understand, indicates that my two env. variables work correctly. However, when I get to the Copy file bit, I get an error (i.e. the same config works in Dev but not in Test). The error is indicated as "Action 'Apply_to_each_file' failed":

 

Rydman_3-1650377442619.png

 

 

I’d expect the Library string (which has its symbolic name in the File To Copy field but it’s GUID in the Destination Folder) to be identical in both fields, but it’s not.

 

Here’s the config for the Copy File:

Rydman_4-1650377442625.png

 

I’ve had problems in the past with the exact composition of the path strings, but, since it works in Dev, that does not seem to be the issue.

 

Any help is greatly appreciated.

 

I have the same question (0)
  • MuraliCh Profile Picture
    2 on at

    @Rydman did you get the solution for this?

  • Rydman Profile Picture
    96 on at

    Hi,

    So long ago...but I'm sure I found a way. In general, dynamically managing connector strings using Environment variables is a nightmare. With the new designer experience, one trick is to configure your connectors using the provided drop-downs, then go look in the Code View. Then at least you see all the dirty details of how the raw strings need to be formatted. Sometimes you get nasty suprises. The Excel connector, for example, expects an arcane id, only retrievable by submitting a HTTP request to the SharePoint API. Nasty. Thank god for the internet!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 638

#2
Haque Profile Picture

Haque 317

#3
WarrenBelz Profile Picture

WarrenBelz 315 Most Valuable Professional

Last 30 days Overall leaderboard