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 / Using a Power Apps Var...
Power Apps
Answered

Using a Power Apps Variable as the Folder Path in SharePoint Create a File connector (Power Automate)

(1) ShareShare
ReportReport
Posted on by 92

Hi folks,

 

I'm creating a Photo Uploading Power App to allow my team to easily search for a project, select it and then add 1 or more photos to an attachment control. They would then hit submit and the Power App will trigger a Flow that will create the files in a specific folder in a SharePoint document library. 

 

When they search for the project and select the project folder, this then gives me the basis for the folder path. Each project folder follows an identical structure, so once the app knows which project they are selecting, it knows the path to save the photos to.

 

I have created a global variable to store the folder path: varUploadPhotoPath

 

Now onto the problem. I cannot seem to pass this variable through to Power Automate no matter what I try. I have tested the flow manually, providing it with the image and the folder path string and it works. But when I try to test it by triggering the flow through Power Apps, it won't even trigger the flow, instead throwing the following error:

 

 

 

UploadFileToDocumentLibrary.Run failed: {"error":{"code": "TriggerInputSchemaMisMatch", "message": "The input body for the trigger 'manual' of type 'Request' did not match its schema definition. Error details: 'Required properties are missing from object: text.'."}}

 

 

 

Here is the code triggering the flow:

 

 

 

ForAll(
 attachPhotos_1.Attachments As Photo,
 UploadFileToDocumentLibrary.Run(
 {
 contentBytes: Photo.Value, // This is for the File Content input
 name: Photo.Name, // This is for the file name (file.name)
 varUploadPhotoPath // This is for the Folder Path input (Text input)
 )
 );

 

 

 

Here is the Flow itself:

 

Screenshot 2023-11-08 214852.png

 

This is heavily based on Matthew Devaney's post: https://www.matthewdevaney.com/power-apps-easiest-way-to-upload-files-to-a-sharepoint-document-libra...

 

Any tips or pointers would be much appreciated!

Categories:
I have the same question (0)
  • Verified answer
    Omainesi Profile Picture
    92 on at

    Thanks for your reply. While your suggestions weren't what fixed the issue, they certainly gave me a few extra routes to look at and I ended up figuring it out.

     

    I wasn't formatting the code properly, I needed to wrap the 2 file properties (contentBytes and Name) in Curly brackets. Pity the error message wasn't much help, but stripping all the code back to basics really helped with troubleshooting this. For reference, here is the code that works:

     

    ForAll(
     attachPhotos_1.Attachments As Photo,
     UploadFileToDocumentLibrary.Run(
     {
     contentBytes: Photo.Value, // This is for the File Content input
     name: Photo.Name // This is for the file name (file.name)
     },
     varUploadPhotoPath
     )
     )

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 March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 551

#2
WarrenBelz Profile Picture

WarrenBelz 430 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 298

Last 30 days Overall leaderboard