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)
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
2\edit fileds(Leave only the attachments field)
3\Modify the update if formula:
UpdateIf(Table1,true,Form1.Updates)
The Result:
I think this link will help you a lot:
Saving attachments using Patch
Best Regards,
Bof
WarrenBelz
146,658
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,999
Most Valuable Professional