cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RiccoHipp
Helper I
Helper I

Upload a file to sharepoint and list it with other data

Hello guys,

 

In my App I create items for sharepoint list (Name, email ,...) and also need to attach sometimes files specific to the item.

 

I read about how to upload files to sharepoint via Flow (Power Apps Easiest Way To Upload Files To A SharePoint Document Library (matthewdevaney.com))

 

The question is, how do I customize this for my needs?

 

I want to create the item, maybe or maybe not attach a related files and save it to the list. If I want to edit the entry later I want to display the file also (no need to edit the file ( except deleting)). At the moment I don't use a form, instead I use custom inputs and Patch them 

 

Example use:

Safe a Person to sharepoint with

- Name

- eMail

- employee contract 

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @RiccoHipp :

Do want to add a attachment to a SP list item using Patch function directly?

If so, you could consider take a try to only add the Attachments field within the Edit form. I have made a test on my side, please take a try with the following workaround:

1\Add an edit form(Form3)

2\Add a button 

OnSelect:

Patch(
    'List A',/*'List A' is my data source*/
    First('List A'),/*Modify the first record in the data source*/
    {Title: "1"},
    Form3.Updates
)

vbofengmsft_0-1642736587001.gif

On your side, you should type following formula:

 
Patch(
   'YourSPList',
    'Your specified record',
    {
      Column1:TextInput1.Text,
      Column2:TextInput2.Text,
      Column3:TextInput3.Text,
      ...,
      ColumnN:TextInputN.Text
    },
    EditForm1.Updates
)

Note: The Editform1 represents the Edit form control within your app, which only display the Attachments field. 

I think these links will help you a lot:

https://powerusers.microsoft.com/t5/Building-Power-Apps/Need-to-add-Attachment-to-a-PATCH-to-a-Share...

https://powerusers.microsoft.com/t5/Building-Power-Apps/Saving-attachments-using-Patch/td-p/277984

Best Rergards,

Bof

View solution in original post

1 REPLY 1
v-bofeng-msft
Community Support
Community Support

Hi @RiccoHipp :

Do want to add a attachment to a SP list item using Patch function directly?

If so, you could consider take a try to only add the Attachments field within the Edit form. I have made a test on my side, please take a try with the following workaround:

1\Add an edit form(Form3)

2\Add a button 

OnSelect:

Patch(
    'List A',/*'List A' is my data source*/
    First('List A'),/*Modify the first record in the data source*/
    {Title: "1"},
    Form3.Updates
)

vbofengmsft_0-1642736587001.gif

On your side, you should type following formula:

 
Patch(
   'YourSPList',
    'Your specified record',
    {
      Column1:TextInput1.Text,
      Column2:TextInput2.Text,
      Column3:TextInput3.Text,
      ...,
      ColumnN:TextInputN.Text
    },
    EditForm1.Updates
)

Note: The Editform1 represents the Edit form control within your app, which only display the Attachments field. 

I think these links will help you a lot:

https://powerusers.microsoft.com/t5/Building-Power-Apps/Need-to-add-Attachment-to-a-PATCH-to-a-Share...

https://powerusers.microsoft.com/t5/Building-Power-Apps/Saving-attachments-using-Patch/td-p/277984

Best Rergards,

Bof

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (2,358)