In this article, let us see how user details including user picture could be captured and saved onto SharePoint as documents using PowerApps and Microsoft Flow.
Here is the detailed scenario: User details like Name, picture, etc. needs to be captured and documented, and has to be made available on SharePoint. This process could be automated with the help of Office 365 SharePoint, PowerApps and Microsoft Flow.
The following points depicts this automated flow.
- Using PowerApps, Custom Form needs to be created showing the required fields.
- Microsoft Flow will be used to capture the information entered into the Form.
- The flow once captures the information, it will format the data and creates the document, before saving it to SharePoint.
- Creation of documents is not straight forward approach. So in this case HTML file needs to be created. [The proper formatting could be done by taking HTML file creation approach.]
- Then HTML file is converted into required format. Then the target document could be uploaded into SharePoint library.
Note: One Drive for Business connectors provides necessary actions for creation and conversion of documents. The same will be leveraged in this samples.
Set up Microsoft Flow
Let us start with creating flow. The available template is leveraged and customized to the requirement.
- Navigate to My Flow on flow.microsoft.com.
- Select New and choose create from template option.
- Then choose Upload a file to SharePoint from PowerApps template. Select continue to setup the flow.
- By default, powerapps trigger and create a file action will be available on the flow.
Additionally insert two more actions in the middle.
- one for creating file. Using Create file action under one drive for business connector.
- another for convert file. Using Convert File action using one drive for business connector.
- File name - concatenate the name chosen from PowerApps and the file extension (.html). The name from PowerApps can be chosen using dynamic content option. (choose CreatefileFileName)
- File content. - Insert the required HTML for PDF content. In the HTML, insert necessary values from PowerApps. (From dynamic content choose CreatefileFileContent.)
If the options are not available under dynamic content, select ask in PowerApps to get more value.
So, the following snapshot shows the file name and HTML source content required for generating the HTML file.
Note: The HTML is directly inserted, and integrated with the PowerApps values, which is not recommended approach. I would suggest you to store it as template somewhere, and you could retrieve and manipulate the data for HTML source.
Upload/Save Document to SharePoint: In the SharePoint - Create File action, provide the library and file information to store the file into SharePoint.
The flow has been setup.
In the next article, let us create the form and integrate the flow totrigger the file creation process.