web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patch Attachments to S...
Power Apps
Answered

Patch Attachments to Sharepoint List

(0) ShareShare
ReportReport
Posted on by

Hi Experts,

 

I'm trying to add attachments from a peninput and also an attachment control into a sharepoint list, i'm trying to avoid having to use power automate as i'd rather everything was in powerapps for ease. Everything with my code is working perfectly apart from getting the attachments into the sharepoint list along with the rest of the data being captured and sent to the list. I've seen that when using patch, you can use a Lookup to get the attachments in but i've no idea where to put it, have you any ideas please? 

 

ClearCollect(
colImages,
AddColumns(
RenameColumns(
AttachmentControl.Attachments,
"Value",
"ContentBytes"
),
"@odata.type",
""
),
{
Name: "Signature.jpg",
ContentBytes: Signature.Image
}
);

Office365Outlook.SendEmailV2("installation@MYDOMAINNAME.com" , 'Result Job Number'.Text , "Hi,<br><br>

Please see completed survey form below and attached drawings<br><br>

<a href=https://MYDOMAINNAME.sharepoint.com/sites/PowerApps/Lists/DoorSurvey/AllItems.aspx>Click Here to View the Full SharePoint List</a><br><br>

<b>Survey Complete?: </b>"&ValueSurveyStatus&"<br>
<b>Customer: </b>"&Customer.Text&"<br>
<b>Address: </b>"&Address.Text&"<br>
<b>Job Number: </b>"&'Job Number'&"<br>
<b>Surveyor: </b>"&Surveyor.Text&"<br>
<b>Date: </b>"&Date.SelectedDate&"<br><br>

<b>Door Ref: </b>"&'Door Ref'&"<br>

<b>Existing Door to Remove: </b>"&ValueExistingDoorToRemove&"<br>
<b>Existing Access Control, Alarm etc: </b>"&ValueExistingAccessControl&"<br>
<b>S/O Substrate: </b>"&'S/O Substrate'&"<br>
<b>Cavity Closer Plates Required: </b>"&ValueCavityCloser&"<br>
<b>Recommended Steel Trim: </b>"&ValueSteelTrim&"<br>
<b>Ancillary Items: </b>"&Ancillary&"<br>
<b>Door Location on Site: </b>"&'Door Location'&"<br>
<b>Clear Access Route: </b>"&ValueClearAccess&"<br>
<b>Team Size: </b>"&'Team Size'&"<br>
<b>Additional Site Equipment: </b>"&'Additional Site Equipment'&"<br>
<b>Onsite Parking: </b>"&ValueOnsiteParking&"<br><br>

<b>Notes: </b>"&Notes&"<br><br>

Regards<br><br>

IT Department<br></br>",
{Attachments: colImages}
);
Reset(AttachmentControl);
Reset(Signature)
;
Patch(DoorSurvey, Defaults(DoorSurvey),
{
SurveyStatus: ValueSurveyStatus.Text,
Title: ValueDateTimeNow.Text,
Customer: Customer.Text,
'Site Address': Address.Text,
'Job Number': 'Job Number'.Text,
Surveyor: Surveyor.Text,
Date: Date.SelectedDate,
'Door Ref': 'Door Ref'.Text,
'Existing Door to Remove': ValueExistingDoorToRemove.Text,
'Existing Access Control, Alarm etc': ValueExistingAccessControl.Text,
'S/O Substrate': 'S/O Substrate'.Text,
'Cavity Closer Plates Required': ValueCavityCloser.Text,
'Recommended Steel Trim': ValueSteelTrim.Text,
'Ancillary Items': Ancillary.Text,
'Door Location on Site': 'Door Location'.Text,
'Clear Access Route': ValueClearAccess.Text,
'Team Size': 'Team Size'.Text,
'Additional Site Equipment': 'Additional Site Equipment'.Text,
'Onsite Parking': ValueOnsiteParking.Text,
Notes: Notes.Text
});
Navigate(Success,Cover)

Categories:
I have the same question (0)
  • Verified answer
    v-bofeng-msft Profile Picture
    on at

    Hi @Dave-ITMan ,

     

    If you want to patch/Update the the attachments file to your SP list individually using Patch/Update function, I afraid that there is no way to achieve your needs in PowerApps currently.

    As an alternative solution, you need to consider your Edit form data as a Whole, and type it within your Patch/Update formula. I have made a test on my side, please take a try with the following workaround:

    1\Create an edit form(Form1) and set it's data source

    vbofengmsft_0-1652332907905.png

     

    2\edit fileds(Leave only the attachments field)

    vbofengmsft_1-1652332907917.png

     

    3\Modify the update if formula:

     

    UpdateIf(Table1,true,Form1.Updates)

     

     

    The Result:

    vbofengmsft_2-1652332907918.png

     

    I think this link will help you a lot:
    Saving attachments using Patch 

    Best Regards,

    Bof

  • Suggested answer
    TimMiles Profile Picture
    6 on at
    I was able to patch directly to a sharepoint list attachment field using the following. Note the first part captures a screenshot using the PDF control and stores it in appres://blobmanager. Then using the table format below in patch, it patches it to the sharepoint list. I havent tried multiple items yet, or how to patch into an attachment field that already has attachments. But this does work
     
    //Capture screenshot
    Set(VarEmployeeSignedDocument, PDF(Testing));
     
    //Patch screenshot to attachments field
    Patch(AisleAuditTransactions,Defaults(AisleAuditTransactions),
            {
               Title:" Test",
               Attachments:Table(
                            {
                                DisplayName: "TestAttachScreenshot.pdf" ,
                                AbsoluteUri: Blank() ,
                                Id: VarEmployeeSignedDocument,
                                Value: VarEmployeeSignedDocument
                            })
            });
     
    Notify("Success", NotificationType.Success,1500);

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard