Sharepoint 2013 How to Extract Infopath Attachments and Upload
We've been helping lots of folk recently to build Period's which extract SharePoint listing item attachments and perform some form of processing, typically to catechumen to a single PDF document and share with a third political party, or add to a records repository.
Scenario:
A SharePoint list is used to store and rails orders, containing all relevant order data and document attachments. When an order is completed, a summary canvas of the order should be compiled and added to a PDF document formed from the document attachments associated with the order, finally the completed PDF document should be sent to the customer via email.
Flow Creation Steps:
1 - Setup a SharePoint listing to store order information, an instance configuration is detailed below:
2 - Create a new Flow from a bare template
3 - Add the 'When an item is created or modified' SharePoint trigger and associate to the list created in pace #1
4 - We need to create a few variables which we will utilize to store data used subsequently within the flow. Firstly, to shop the HTML summary of the order and secondly, to store an assortment of the attachments which will be merged into a PDF document.
Create a new variable using the 'Initialize variable' activity, applying the following configuration:
Note: I recommend re-naming the actions mail service creation to something meaningful… helps Period authoring as the Flow becomes more complex.
five - Create another new variable using the 'Initialize variable' activeness, applying the following configuration:
6 - Add a 'Status' action, applying logic to determine whether the Flow should continue to execute. I've set the status to check whether the 'Order Condition' value is equal to 'Paid' for the current SharePoint particular.
7 - Checkpoint: Your new Flow should wait similar to the following:
8 - The next objective is to obtain all of the attachments attached to the current SharePoint list particular and merge them into a single PDF document.
Add together a 'Get attachments' SharePoint activity applying the following configuration:
- Site Accost: Set equally per the 'Site Address' value set up in #iii
- List Proper noun: Set up as per the 'List Name' value set in step #three
- ID: Insert the 'ID' property from the 'When an item is created or modified' action result
Notation: If you cannot run across the ID field, click 'See more'
9 - Add an 'Apply to each' control action, applying the following configuration:
- Select an output from previous steps: Insert the 'Trunk' belongings from the 'Apply to each' action result.
10 - Inside the 'Apply to each' loop, add a 'Go attachment content' action, applying the following configuration:
- Site Address: Set as per the 'Site Accost' value set up in #3
- List Name: Set as per the 'List Name' value set up in step #iii
- Id: Insert the 'ID' property from the 'When an item is created or modified' trigger.
- File Identifier: Insert the 'Id' belongings from the 'Go attachments' activeness result
11 -Checkpoint: Your new Flow should look similar to the following:
12 - The next step is append the zipper data to the previously created 'FilesForMerge' array belongings which will later exist used to send the files for PDF conversion and merging.
Add together an 'Append to assortment variable' action, applying the following configuration:
- Name: Select the 'FilesForMerge' variable
- Value: Enter the following JSON:
{ "fileName": "@{items('Apply_to_each')['DisplayName']}", "fileContent": "@{body('Get_attachment_content')['$content']}" }
Note: If you have changed the default names of the deportment, you will demand to amend the expressions accordingly.
13 - Underneath the 'Apply to each' action, add a 'Merge document array to PDF' action, applying the following configuration:
Detailed guidance:Merge document assortment to PDF
- PDF Filename: Enter 'Guild confirmation.pdf'
- Click the 'Switch to input array icon'
- Documents: Insert the 'FilesForMerge' variable.
14 - The next step is to compile the HTML summary which should be inserted into the merged PDF document.
Add a 'Set up variable' activity, and configure equally follows:
- Name: Select the 'HtmlSummary' variable
- Value: Enter the following sample HTML fragment or please create your ain as required
<div> <img src="https://www.encodian.com/avails/img/Encodian_Logo.png"> </div> <div> <ul> <li><b>Order Number:</b> @{triggerBody()?['Title']}</li> <li><b>Customer Name:</b> @{triggerBody()?['Customer_x0020_Name']}</li> <li><b>Client Address:</b> @{triggerBody()?['Customer_x0020_Address']}</li> <li><b>Purchase Order:</b> @{triggerBody()?['Purchase_x0020_Order']}</li> <li><b>Club Details:</b> @{triggerBody()?['Order_x0020_Details']}</li> <li><b>Society Placed:</b> @{triggerBody()?['Created']}</li> <li><b>Gild Paid:</b> @{triggerBody()?['Modified']}</li> </ul> </div>
Note: The HTML fragment contains expressions to inject properties from the 'When an item is created or modified' trigger, simply update equally required by selecting different properties.
15 - The next step is to insert the HTML fragment contained inside the 'HtmlSummary' variable into the PDF document generated past the 'Merge document array to PDF' action (Step #13).
Add an 'Insert HTML to PDF' action, applying the following configuration:
Detailed guidance:Insert HTML to PDF
xvi - Add a 'Send an email' action, applying the following configuration:
- To: Insert the 'Customer Email Accost' belongings from the 'When an detail is created or modified' trigger, or manually enter an email address.
Notation: You will but come across properties for list columns present on the source SharePoint list.
17 - Complete: Your flow is complete and now ready for testing!
18 - I've added the post-obit list item to the SharePoint listing for testing, upon setting the 'Order Status' field to 'Paid', the Menstruation volition be fully executed!
19- The executed menstruum and relevant results are depicted below:
I promise y'all've found this short(ish) tutorial useful, please allow me know if there are any specific scenarios you would like to run across documented solutions for!
All the best
Jay – Encodian
@encodian
Source: https://powerusers.microsoft.com/t5/Power-Automate-Community-Blog/Guide-Working-with-SharePoint-Listitem-Attachments-JSON-Arrays/ba-p/212864
0 Response to "Sharepoint 2013 How to Extract Infopath Attachments and Upload"
Post a Comment