Downside description
When you’ve ever tried so as to add an attachment management in Energy Apps and save the uploaded file to SharePoint utilizing Energy Automate, you have most likely run right into a irritating downside. When a consumer selects a file, its worth is briefly saved in an inner Energy Apps format as a hyperlink beginning with appres://blobmanager/.... It appears innocent sufficient, till you really attempt to ship that file someplace. The issue is that Energy Automate can’t “fetch” a file from such an deal with. It’s purely an inner non permanent identifier that Energy Automate has critical hassle decoding. In consequence, the circulation both throws an error or an empty and corrupted file finally ends up on SharePoint.
Answer
Step 1. Including an Attachment Management With out a Type
In Energy Apps, you needn’t use a Type element to make use of the attachment management. Merely copy the YAML code under and paste it into the display tree. The management shall be added robotically.
Attachment1:
Management: Attachments
Properties:
BorderColor: =Colour.Purple
BorderThickness: =5
Fill: =RGBA(169,169,169,.5)
Top: =268
MaxAttachments: =1
Measurement: =18
Width: =402
X: =60
Y: =111
Step 2. Including an Attachment and the Worth situation
As soon as the management is added and the consumer selects a file, we are able to examine the worth of the primary attachment utilizing the components:
First(Attachment1.Attachments).Worth
As you may see within the screenshot under, the returned worth takes the format appres://blobmanager/… That is an inner non permanent deal with utilized by Energy Apps that can not be straight handed to Energy Automate to avoid wasting the file to SharePoint.

Step 3. Making a Gallery for File Conversion
To extract the file knowledge in Base64 format, we have to use a gallery. Add a Gallery element to the display, then in its Gadgets property enter:
Attachment1.Attachments
The gallery will now iterate over all added attachments.

Step 4. Setting Up the Picture Management within the Gallery
Go contained in the gallery and choose the Picture management. In its Worth property enter:
ThisItem.Worth
This manner the picture management will load the file from the attachment which within the subsequent step will enable us to learn its binary knowledge in Base64 format.

Step 5. Hiding the Gallery
The gallery serves purely as a conversion mechanism. The consumer does not must see it. Set the Seen property of the gallery to:
false
Step 6. Save Button and File Knowledge Assortment
Add a button that may set off the save motion. In its OnSelect property, create a set containing the identify and content material (in Base64) of every attachment:
ClearCollect(
colFileContents,
ForAll(
Gallery2.AllItems,
With(
{
dataUriSchemePDF:
MatchAll(
JSON(Image2.Picture, JSONFormat.IncludeBinaryData),
"(?:[^"":;,]+)"
)
},
{
identify: Title,
content material: Index(dataUriSchemePDF, 4).FullMatch
}
)
)
)
The components iterates over the gallery gadgets, extracts the binary picture knowledge as Base64 utilizing JSON() with the IncludeBinaryData flag, then makes use of MatchAll() to parse the ensuing string and saves the file identify and its Base64 content material to the colFileContents assortment.

Step 7. New Move in Energy Automate
Go to Energy Automate and create a brand new circulation triggered by a Energy Apps set off. Add one enter parameter of kind Textual content named: JSON In my case the circulation is known as attachmentsFlow. This identify shall be wanted when calling it from Energy Apps.

Step 8. Apply to Every Loop
Add an Apply to every motion. Because the listing parameter, enter the expression:
json(triggerBody()['text'])
Energy Automate will parse the submitted JSON and iterate over every file within the assortment.

Step 9. Saving the File to SharePoint
Contained in the loop, add a Create file motion from the SharePoint connector. Fill within the fields as follows:
gadgets('Apply_to_each')?['name']
base64ToBinary(gadgets('Apply_to_each')?['content'])
The base64ToBinary() perform converts the Base64 knowledge again into binary type, which SharePoint can save as a file.

Step 10. Connecting the Move to Energy Apps
Save the circulation in Energy Automate. Return to Energy Apps, add your circulation to the app (the Energy Automate tab within the aspect panel → Add circulation), then full the OnSelect property of the button with the circulation name:
attachmentsFlow.Run(JSON(colFileContents))
The JSON() perform serializes the colFileContents assortment right into a textual content JSON format, which the circulation will obtain as an enter parameter and course of within the loop.

Step 11. Verifying the Recordsdata Had been Saved to SharePoint
After launching the app and urgent the save button, we are able to navigate to the goal library on SharePoint and ensure that the information have appeared accurately. As you may see within the screenshot under, the information had been saved with none points.

Abstract
As you may see, the appres:// format situation might be labored round with out a lot effort. The secret is to not directly use a gallery and a picture management to extract the file knowledge in Base64 format on the Energy Apps aspect. Energy Automate then takes care of the remainder, decoding the file and saving it to SharePoint. As soon as configured, the answer works reliably and works for any file kind, not simply photos. Regardless of utilizing a picture management because the extraction mechanism, this method handles any file kind: PDFs, Phrase paperwork, Excel spreadsheets, ZIP archives, and extra. The picture management is solely a handy automobile for studying appres://blobmanager as Base64. The precise content material of the file is preserved intact no matter its format.

