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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to send attachment...
Power Apps
Unanswered

How to send attachments to a SharePoint list through a gallery?

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello, I have a button called 'Add Step' with the following code:

 

Collect(colEtapas;{ID:Last(colEtapas).ID+1; nomEtapa: "";Valores:"Valores";NumeroSequencial:CountRows(colEtapas) + 1})

 

Djequi_0-1695818150131.png

 

 

When you click this button, it adds a new line "new step" in a gallery. Each line has two fields, a text entry, and a combobox with the multiple selection function enabled. I need to add a third field in the gallery row, so I can add attachments and send to a list in sharepoint. Could anyone help me with creating this attachment field in the gallery, and how do I send it to my sharepoint list? Here is my code for sending the two fields in the gallery line:

 

ForAll(Gallery1.AllItems;
With(
{
Id_EtapaCriada:
Patch(AG120SOLETAPA;Defaults(AG120SOLETAPA);
{
nomEtapa: ThisRecord.txtNome_Etapa.Text;
id_Etapa: ThisRecord.lbl_numero_etapa.Text;
id_solProcesso: {Id:varSolicitacaoProcessoCadastro.ID; Value:""}
}
)
};


ForAll(ComboBoxSistemas.SelectedItems;
Patch(AG120SISETAPA;Defaults(AG120SISETAPA);
{
id_Sistema:{Id:ThisRecord.ID;Value:""};
id_Etapa: {Id:Id_EtapaCriada.ID;Value:""}
}
)
)
)

);;

Categories:
  • v-mengmli-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    I noticed that you are using Patch to update data, but currently PowerApps does not support using Patch to update attachments directly to the attachment column. Here I provide another workaround: do not apply patch and do not use the ForAll loop, upload files to SPlist when the user adds files.

     

    1)Create a edit form and copy the attachment control to gallery:

    vmengmlimsft_0-1695781908773.png

    2)Set the attachment control in gallery:

    Items:ThisItem.Attachments
    OnAddFile:ClearCollect(Atch,Self.Attachments);SubmitForm(EditForm)

    3)Set the attachment control in Edit form:

    Items:Atch

    4)Set the Edit Form:

    Item:Gallery.Selected
    Visible:false

     

     

    Hope this helps you!

    -----------------------------------------------------------------------------------------------------------------------------------

    If my answer solves your problem, please accept it as a solution to help more people stuck on the same problem find it.

     

    Best regards,

    Rimmon Li

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hello 

     

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hello 

     

    I had already managed to achieve this result this way.

    Djequi_0-1695816602736.png

    But what I need is to add the attachment field to the right of my gallery line, so that it always adds one more when clicking on my add step button, and somehow send this information to sharepoint, just like with my field text input and my combobox. I know that you can't add files to collections, and this is my biggest problem. Because when clicking the add step button I create a temporary record in the collection that is deleted after clicking the submit button where it contains the forall code.

    Djequi_1-1695816769599.png

     

     

     

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 432 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 347

#3
WarrenBelz Profile Picture

WarrenBelz 254 Most Valuable Professional

Last 30 days Overall leaderboard