1
Answer

How to attach file and store it in sharepoint library

Photo of Guest User

Guest User

1y
490
1

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? 

 

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);
Markup

Answers (1)

2
Photo of Naimish Makwana
134 13.8k 203.2k 1y

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

Accepted