cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Oskarkuus
Post Prodigy
Post Prodigy

Display a picture in a gallery from a sharepoint list - how to add new pictures?

i have a sharepoint list as datasource

i have set the attachment column in the datasource to only allow one uploaded file.

 

I want to display this uploaded file in a gallery that have the datasource in ITEMS property.

 

how to do this? i cant figure out how to load that file in an image controle?

 

i have tried use the powerapps control "add image".... but then i cant figure out how to save that picture to the datasource.

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-yutliu-msft
Community Support
Community Support

Hi @Oskarkuus ,

Could you tell me whether you have problem about displaying attachments in your gallery or updating your attachments?

1)how to display attachments in your gallery

If one item only has one attachment, you could set like this:

gallery's Items:

listname

image control's Image:

 First(ThisItem.Attachments).AbsoluteUri

Just like this:

101.PNG

 

If one item has multiple attachments , you could set like this:

gallery1's Items:

listname

gallery2's Items:

Gallery1.Selected.Attachments

Image control's Image (inside gallery2):

ThisItem.AbsoluteUri

Just like this:
1011.PNG

 

2)How to update attachments?

I'm afraid it's not supported to update attachments by using add picture button.

You could only use attachments control to update attachments. What's more, attachments only work inside a form and should be updated by using SubmitForm() function.

You should set like this:

gallery's Items:

listname

insert a form to upload attachments

set the form's data source to the same list

set the form's Item:

Gallery1.Selected

Only choose attachments in this form

set the attachments control's OnAddFile:

SubmitForm(Form2)

set the attachments control's OnRemoveFile:

 

SubmitForm(Form2)

 

Then after you select item in the gallery, you could upload file in that form.

Just like this:
101.gif

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
RandyHayes
Super User
Super User

@Oskarkuus 

If you only have one attachment in the attachments that you want to display, then you can put an Image control in your Gallery and set the Image property to First(ThisItem.Attachments).Value

That should display it.

 

I hope this is helpful for you.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
v-yutliu-msft
Community Support
Community Support

Hi @Oskarkuus ,

Could you tell me whether you have problem about displaying attachments in your gallery or updating your attachments?

1)how to display attachments in your gallery

If one item only has one attachment, you could set like this:

gallery's Items:

listname

image control's Image:

 First(ThisItem.Attachments).AbsoluteUri

Just like this:

101.PNG

 

If one item has multiple attachments , you could set like this:

gallery1's Items:

listname

gallery2's Items:

Gallery1.Selected.Attachments

Image control's Image (inside gallery2):

ThisItem.AbsoluteUri

Just like this:
1011.PNG

 

2)How to update attachments?

I'm afraid it's not supported to update attachments by using add picture button.

You could only use attachments control to update attachments. What's more, attachments only work inside a form and should be updated by using SubmitForm() function.

You should set like this:

gallery's Items:

listname

insert a form to upload attachments

set the form's data source to the same list

set the form's Item:

Gallery1.Selected

Only choose attachments in this form

set the attachments control's OnAddFile:

SubmitForm(Form2)

set the attachments control's OnRemoveFile:

 

SubmitForm(Form2)

 

Then after you select item in the gallery, you could upload file in that form.

Just like this:
101.gif

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

@v-yutliu-msft 

As long as you're not planning to use this on mobile devices it would work.  Otherwise, use the Value as in the formula I provided.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Powerplatform01
Post Patron
Post Patron

Hi,

You can watch this video to resolve your issue

https://youtu.be/pXLFmX7cxUc

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,439)