Hi Team
I have fileContent as my input for power app, now i want to integrate this field with Run function on the form, how to attach file and be stored in sharepoint?
Code
RestartNCRFlow.Run(Finding_desc.Text, Text(Due_Date_Details_Calendor.SelectedDate, "yyyy-mm-dd"),
Root_Cause_txt.Text, Corrective_Action_txt.Text, Prevent_Action_txt.Text, Status_Details_dropdown.SelectedItems, {}// file attachment logic here);
NewForm(Corrective_Action_Form);
SubmitForm(Corrective_Action_Form);
Naimish MakwanaRank #324 · 7.7K reputationPosted Apr 30, 2024, 6:14 AM EDT
To attach a file and store it in SharePoint from Power Apps, you can use the
Patchfunction to create or update records in your SharePoint list. Here’s how you can modify yourRunfunction to include file attachment logic:// Assuming 'fileContent' is your file input control Set( varFileContent, fileContent.SelectedItems ); Collect( colAttachments, ForAll( varFileContent, { DisplayName: DisplayName, '@odata.type': "", Value: Value } ) ); RestartNCRFlow.Run( Finding_desc.Text, Text(Due_Date_Details_Calendor.SelectedDate, "yyyy-mm-dd"), Root_Cause_txt.Text, Corrective_Action_txt.Text, Prevent_Action_txt.Text, Status_Details_dropdown.SelectedItems, colAttachments ); NewForm(Corrective_Action_Form); SubmitForm(Corrective_Action_Form);In this code,
fileContent.SelectedItemsis used to get the selected file(s) from your file input control. TheForAllfunction is used to iterate over each selected file and create a collection (colAttachments) of attachments. This collection is then passed to yourRunfunction.Please replace
fileContentwith the actual name of your file input control in Power Apps. Also, ensure that your flow (RestartNCRFlow) is set up to accept and handle the file attachments.Thanks