Good day,
I'm creationg a power app that has a "form" that contains multiple attachment controls.
at the end of the form I have created a button that creates a collection with the names and values of each attachment control and format it to Json Payload that includes binary data.
(Please mind that code is in France Regional syntax):
The button code:
// Clear the existing collection
ClearCollect(
attachmentnames;
// Check if doc_1 has an attachment and add it to the collection if it does
If(CountRows(doc_1.Attachments) > 0; {Name: "Pièce d'identité_" & nometprenom.Value & "_" & First(doc_1.Attachments).Name; Content: JSON(First(doc_1.Attachments).Value)});
// Repeat for each attachment control
If(CountRows(doc_2.Attachments) > 0; {Name: "Pièce d'identité_" & nometprenom.Value & "_" & First(doc_2.Attachments).Name; Content: First(doc_2.Attachments).Value});
If(CountRows(doc_3.Attachments) > 0; {Name: "Pièce d'identité_" & nometprenom.Value & "_" & First(doc_3.Attachments).Name; Content: First(doc_3.Attachments).Value});
If(CountRows(doc_4.Attachments) > 0; {Name: "Pièce d'identité_" & nometprenom.Value & "_" & First(doc_4.Attachments).Name; Content: First(doc_4.Attachments).Value});
If(CountRows(doc_5.Attachments) > 0; {Name: "Pièce d'identité_" & nometprenom.Value & "_" & First(doc_5.Attachments).Name; Content: First(doc_5.Attachments).Value});
If(CountRows(doc_6.Attachments) > 0; {Name: "Pièce d'identité_" & nometprenom.Value & "_" & First(doc_6.Attachments).Name; Content: First(doc_6.Attachments).Value});
If(CountRows(doc_7.Attachments) > 0; {Name: "Pièce d'identité_" & nometprenom.Value & "_" & First(doc_7.Attachments).Name; Content: First(doc_7.Attachments).Value});
If(CountRows(doc_8.Attachments) > 0; {Name: "Pièce d'identité_" & nometprenom.Value & "_" & First(doc_8.Attachments).Name; Content: First(doc_8.Attachments).Value});
If(CountRows(doc_10.Attachments) > 0; {Name: "Pièce d'identité_" & nometprenom.Value & "_" & First(doc_10.Attachments).Name; Content: First(doc_10.Attachments).Value})
);;
// Convert collection to JSON
Set(
jsonPayload;
JSON(attachmentnames;JSONFormat.IncludeBinaryData)
);;
I have created a text canvas to hold the jsonPayload output, and the issue is that the outcome of the content is a "blob"; here is a wee exemple:
[{"Content":"\"appres://blobmanager/69fdd2c0485e4e34b9e8c1fd84d36885/29\"","Name":"Pièce d'identité__Serveur Global Protect.txt"}]
When running my flow: I want to be able to save the files in a sharepoint library, and this is where I am blocked.
The flow is supposed to convert the supposed to be "Base64" output of my JsonPayload, and because the Schema is not correct, the flow fails.
And I feel like I'm in a dead end.
Any solution to get the "correct format"?
Thanks in advance.