Upload a Word Document from a Power Apps Canvas App to SharePoint Using Power Automate


In this tutorial, we will learn how to upload a Word document from a Power Apps Canvas App and save it to a SharePoint document library using Power Automate.

The solution uses a Power Apps (V2) trigger with a file input. The Canvas App passes the selected file to Power Automate, and the flow uses the SharePoint Create file action to save the document.

·    Create a Canvas app

·    Open the created app

·    Click -->Insert -->Select Media->Add picture.

·    Add below formula OnSelect property.

Set(fileType,
Lower(Last(Split(AddMediaButton1.FileName, ".")).Value));
Set(FileName,AddMediaButton1.FileName);

 



 

Button Event OnSelect:

CreateDocumentInSharepoint.Run(

FileName, fileType,

                {

                    contentBytes: AddMediaButton1.Media,

                    name: AddMediaButton1.FileName

                }

            )

 



Click on 3 dots Select PowerAutomate Create a power Automate flow with CreateDocumentInSharepoint

 


Flow will open Add 3 parameter

·        FileName

·        DocType

·        FileContent

​​​​​​​Create File (sharepoint)

·        Site Address: select SharePoint connect

·        Folder Path: Select site content in SharePoint document folder path

·        File Name: triggerBody()[“text]

·        File Content: triggerBody()?[‘file’]?[‘contentBytes’]

 






Attach the file in canvas app on click on submit button.



Once  the flow run successfully Navigate to Sharepoint site and check file is uploaded.

 


 


 



Comments

Popular posts from this blog

How to implement approval in Teams using Adaptive Cards

How to Export and Import Dynamics 365 Dataverse Records Using Configuration Migration Tool

Azure Function to Read Incoming Message in Twilio

Connect to Dynamics CRM from Azure Function

Receive Incoming Message in Twilio using Power Automate