Upload inspections to SharePoint
A ready-made template exists for this that can be used as a complete solution or starting point.
- Picking up where the Automatically export inspection with Power Automate guide left off, we will extend the flow to automatically upload inspection reports to SharePoint.
Add an action within the Apply to each loop and after the Download an audit report step. We will use Get a specific audit to retrieve data from within each inspection to name the files and folders in SharePoint.
- Next, SharePoint’s Create file action will be used. Add it immediately after Get a specific audit and select your SharePoint site within the Site address drop-down field.
- We can then choose a document library from your site to automatically folder your inspection reports. To do this, click the folder icon to the right-hand side of the Folder path. With your document library selected, click at the end of the text within the Folder path field and type a slash “/”. At this point, we can configure ‘dynamic foldering’ based on data within each of your inspections. For the purpose of this guide, we are going to store inspections by template.
[Note]Individual SharePoint lists, document libraries, and folders can only contain a maximum of 5000 items. Dynamically foldering your exports is necessary for this reason as it spreads your exports across multiple folders and avoids reaching the limit. Using a part of the date of each inspection (e.g. the Month an inspection is completed in) is another option for your folder names.[/note]
- Go ahead and click on the Folder path field again, after the ending slash “/” and then click Add dynamic content. To folder based on the template, an inspection was created from, choose the Template Name dynamic content. Here’s what you should end up with:
- We can also use dynamic content to name the inspection report file based on data within each inspection, too. This guide will set up file names so that the inspection author, date completed and score percentage, are used. Doing so involves clicking the File Name field and then choosing Audit Author, Date Completed and Score Percentage from the available dynamic content listed under Get a specific audit.
- You may have also noticed from the screenshot above that we have manually typed hyphens “-” between each of the selected dynamic content and also “.pdf” at the end.
- All that remains is to click the File Content field and select Audit Report from the dynamic content provided by Download an audit report. IMPORTANT NOTE
You could also use a combination of SharePoint’s Create item and Add attachment actions to create new list items with data populated from the inspections and the inspection reports attached. Update SharePoint list items with inspection data
- The end result: