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

ADD ATTACHMENT IN GALLERY CONTROL

Dear Expertise, 

 

I want to save attachments from the gallery (To save attachments from the UI of PowerApps to particular item on SharePoint List). What should be my approach and the code? As you can see below, I have taken the attachment control from the form and pasted on the gallery, not sure how to save data through it. Is it possible to do it? Or is there any generic way to do it? Please suggest.

QASE1.PNG

 

Here is the code on OnSelect properties for my Submit button.

QASE2.PNG

 

Can someone provide me guidance/help on this? Please share screenshots as i'm a beginner on PowerApps.

 

Thank you in advance,

Athirah

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @Athirah :

Do you want to add attachments through Gallery?

If so,this is impossible in theory, but I have a alternative solution.

The main point of this solution is to submit attachments through an invisible form. I've made a test for your reference:

1\My data source:

1.JPG

2\Add an edit form control(Form1)

DataSource

BookLog

Item

Gallery4.Selected /*I'll create Gallery4 later*/

3\Add a gallery control 

Items 

BookLog

4\Unlock Form1's Attachment data card and copy the Attachment control(DataCardValue3) into Gallery4(DataCardValue3_1)

2.JPG

5\Set DataCardValue3_1

Items

ThisItem.Attachments

OnAddFile

ClearCollect(TheActh,Self.Attachments);SubmitForm(Form1);  /*TheActh is my custom variable*/

6\Set DataCardValue3 (which in form1) 's Items property to

TheActh

7\Set Form1‘s Visible property to 

false

16.gif

Best Regards,

Bof

View solution in original post

6 REPLIES 6
WarrenBelz
Super User
Super User

Hi @Athirah <

The only two ways of saving attachments are SubmitForm() from a form or via Power Automate. You cannot save them from a re-purposed attachment control in a gallery.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

WarrenBelz
Super User
Super User

Hi @Athirah ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

v-bofeng-msft
Community Support
Community Support

Hi @Athirah :

Do you want to add attachments through Gallery?

If so,this is impossible in theory, but I have a alternative solution.

The main point of this solution is to submit attachments through an invisible form. I've made a test for your reference:

1\My data source:

1.JPG

2\Add an edit form control(Form1)

DataSource

BookLog

Item

Gallery4.Selected /*I'll create Gallery4 later*/

3\Add a gallery control 

Items 

BookLog

4\Unlock Form1's Attachment data card and copy the Attachment control(DataCardValue3) into Gallery4(DataCardValue3_1)

2.JPG

5\Set DataCardValue3_1

Items

ThisItem.Attachments

OnAddFile

ClearCollect(TheActh,Self.Attachments);SubmitForm(Form1);  /*TheActh is my custom variable*/

6\Set DataCardValue3 (which in form1) 's Items property to

TheActh

7\Set Form1‘s Visible property to 

false

16.gif

Best Regards,

Bof

Just wondering is there a way to get onremovefile to work? I’m struggling with that. 

Hi @v-bofeng-msft , 

Do you know how I can delete a file?

The only way I can think of is deleting all attachments first, via power automate, then using submit form.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,264)