cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Gargoolgala
Resolver II
Resolver II

Patch Attachments

Hi,

 

I am using the new attachments option just released and I need to save the attachments but I do not know the syntax for PAtch to save the attachments.  I use Attachments:dcvAttachment.Attachments but it says the specified column does not exist.

 

I do not actually have a column called attachments in my SP List but I have enabled the attachments option and I can see a column called Attachments if I view the list.

 

I cannot use SubmitForm as it has limitations where it resets to defaults which will not work for me.

 

Any ideas on how to save the attachments using Patch?

14 REPLIES 14

@v-monli-msft

 

Is it possible to concatenate field value to SharePoint list Attachement filed ??

 

 

Regard's 

attachment.JPG

i didnt understand . ?? How u have patched the attachment if form is in edit more??

Can you explain it simpler?
RachelRig
Advocate V
Advocate V

I encountered this problem as well. I had a form that I could not simply "submit" because of cascading dropdowns and custom data cards. SubmitForm was just not working for me, so I was able to successfully Patch all the values I needed to SharePoint. However, I was unable to upload any attachments with a Patch statement.

 

I came up with this imperfect workaround: I added a second Form to the app. In this Form2, I removed all fields except the Attachment control. (I made sure there were no required fields in SharePoint so that it would not object to having empty fields upon submission.)

 

I placed this Form2 on the app so that it looked just like part of Form1. My Patch statement then concluded with SubmitForm(Form2). So, this works...SORT OF. It actually created my line item with the Patch, then created a second line item with ONLY the Attachments (no metadata values, as expected). Not ideal by any stretch, but at least I could grab the attachments going forward.

 

So then I wrote a Flow that runs on item creation and immediately looks for the condition of Has Attachments = true. If TRUE, then I put all the attachments in an array and email it to the appropriate business person. Then the Flow goes back and cleans up (deletes) the list item that is empty except for the attachments. So the attachments submitted by the user are not associated with the correct line item in the list, but at least the person being notified of the new list item has them. 

 

It's too bad that we have to keep choosing between SubmitForm and Patch. I keep running into dumb little limitations for things that should be simple.

 

Here is the Patch statement I used:

Patch(
    'Standards Requests',
    Defaults('Standards Requests'),
    {
        Title: TitleCardNew.Text,
        DistStandard: DistStandardNew.Value,
        txtDocType: DocTypeNew.Selected.Title,
        txtOwner: OwnerNew.Selected.DisplayName,
        txtDepartment: DataCardValue4.Selected.Result,
        txtProcedure: lblProcedureText.Text,
        Purpose: PurposeNew.Text,
        SummaryOfChanges: SummaryNew.Text,
        txtRequestType: "New"
    }
);
SubmitForm(Form2);
Navigate(CONFIRM);

 

One Year later. Any updates about uploading Attachments  in a Patch function to a SharePoint List?

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,210)