Article content:
Overview
Encodian flow actions receive and send files in Base64 encoded strings, conforming to how Microsoft expect documents to be sent and received across Flow, Logic Apps and PowerApps.
A common scenario within Office 365 is to perform actions upon a document stored within SharePoint or OneDrive, and there are default flow actions provided which obtain the required documents within the correct format.
Video Guidance
Please either watch the following instructional video or follow the detailed steps within this article.
File Contents - Get a File
The following instructions outline how to retrieve a file from SharePoint, passed within the 'File Contents' property:
1. Within your Flow workflow add the required trigger, the following example uses a simple 'Recurrence' trigger. Click the 'New Step' icon to locate the required Flow action.
2. Enter 'Get file content' within the search field, locate the 'SharePoint' flow action and click to select.
3. Select the SharePoint site and required document using the 'Site Address' and 'File Identifier' pickers.
Please refer to the following Microsoft documentation for further guidance on the 'Get file content' flow action: Connector Reference - SharePoint
4. Click the 'New Step' icon to add another flow action, entering 'Encodian' within the search field, before locating and selecting the 'Convert to PDF' flow action.
5. Click the 'Convert to PDF' flow actions 'File Content' input field. This will display a list of the current flows actions and associated properties which are available for use, select the 'File Content' property of the 'Get file content' action.
6. Add values for the 'PDF Filename' and 'Filename' properties, please refer to the Flow Action - Convert to PDF article for detailed guidance.
The flow is now configured to retrieve the selected document and pass it to an Encodian flow action using the 'File Content' property.
'File Content' - Create a File
Building upon the previous example; Once the Encodian flow action has completed the required operation successfully, the document will be returned within the 'File Content' property. The following steps detail how you can use this property to create a file within SharePoint.
1. Click the 'New Step' icon to add another flow action, entering 'Create File' within the search field, before locating and selecting the SharePoint 'Create File' flow action.
2. Select the SharePoint site and library/folder location using the 'Site Address' and 'Folder Path' pickers.
3. Click the 'Create file' flow actions 'File Name' input field. This will display a list of the current flows actions and associated properties which are available for use, select the 'Filename' property of the 'Convert to PDF' action.
4. Click the 'Create file' flow actions 'File Content' input field. This will display a list of the current flows actions and associated properties which are available for use, select the 'File Contents' property of the 'Convert to PDF' action.
5. The flow is now configured to retrieve the selected document from SharePoint, and convert it to PDF format before uploading the resulting PDF document to SharePoint.
Save and test the flow utilising the standard flow commands.
Array of File Contents
A common scenario is to construct an array of documents for processing, for example to use in our Merge document array to PDF or Add to Archive (ZIP) or Merge Word Documents actions.
Initialise an array variable and then use the "Append to array variable" action in PowerAutomate to add file content using the following JSON Schema:
{
"fileName": "filename including extension",
"fileContent": "File content"
}
Your flow would look something like this:
This works well with SharePoint File content. However, Encodian File content (which is in same Base64 format as the SharePoint content) is manipulated by PowerAutomate and results in a corrupted file and causes the flow to fail.
When adding Encodian file content to arrays, simple use the following JSON schema to tell PowerAutomate not to corrupt the file:
{
"fileName": "filename including extension",
"fileContent": <<base64tobinary(Encodian File Content)>>
}
Using the expression builder, insert base64tobinary(Encodian File Content) as file content:
Please see this video for a demonstration:
0 Comments