To attach a file and store it in SharePoint from Power Apps, you can use the Patch
function to create or update records in your SharePoint list. Here’s how you can modify your Run
function 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.SelectedItems
is used to get the selected file(s) from your file input control. The ForAll
function is used to iterate over each selected file and create a collection (colAttachments
) of attachments. This collection is then passed to your Run
function.
Please replace fileContent
with 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