Skip to main content
Community site session details

Community site session details

Session Id : A8bBXncKvPvr+eZKeU22fw
Power Apps - Power Apps Governance and Administ...
Unanswered

Error using Environment variable for SharePoint library in Cloud Flow

Like (1) ShareShare
ReportReport
Posted on 19 Apr 2022 14:11:34 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.

 

  • Rydman Profile Picture
    96 on 14 May 2024 at 15:05:06
    Re: Error using Environment variable for SharePoint library in Cloud Flow

    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!

  • MuraliCh Profile Picture
    2 on 14 May 2024 at 14:52:17
    Re: Error using Environment variable for SharePoint library in Cloud Flow

    @Rydman did you get the solution for this?

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2

Featured topics

Loading complete