
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:
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!
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
)
)