cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
dmowry
Level: Powered On

Showing image from Sharepoint attachments

I am using a Gallery list "Title and subtitle on overlay" to show a list of items from SharePoint library. If a user adds an image as an attachment to the item, I'd like to show the image if uploaded, if not, to use the SampleImage instead.

 

Note: I'm new to PowerApps and have been going through a basic understanding, so be kind if I missed how to do this and it's really simple. 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
myke_deabreu
Level 8

Re: Showing image from Sharepoint attachments

Hi Dmowry,

 

Since the attachments could have multiple attachments PowerApps by default cant return the value as it does not know which specific one you are looking for. 

 

So the solution is this:

 

On the image function set your value to (See Attached as well): 

First(ThisItem.Attachments).Value

 

That formula basically says return the first attachment (Provided it is a compatible image file). You could also use Last.

 

Let me know if this works for you or not.

5 REPLIES 5
myke_deabreu
Level 8

Re: Showing image from Sharepoint attachments

Hi Dmowry,

 

Since the attachments could have multiple attachments PowerApps by default cant return the value as it does not know which specific one you are looking for. 

 

So the solution is this:

 

On the image function set your value to (See Attached as well): 

First(ThisItem.Attachments).Value

 

That formula basically says return the first attachment (Provided it is a compatible image file). You could also use Last.

 

Let me know if this works for you or not.

dmowry
Level: Powered On

Re: Showing image from Sharepoint attachments

That worked beautifully, thank you.

 

Now I want to wrap that in an IF statement so if there is no attachment to show SampleImage. This is is what I put in, but it's saying it's wrong. I'm going to do some reasearch but if you know what i'm doing wrong here, then let me know.

 

If(ThisItem.'Has attachments',(ThisItem.Attachments).Value,SampleImage)

myke_deabreu
Level 8

Re: Showing image from Sharepoint attachments

You forgot to add "First"

 

If(ThisItem.'Has attachments',First(ThisItem.Attachments).Value,SampleImage)

dmowry
Level: Powered On

Re: Showing image from Sharepoint attachments

Sigh, it's Monday isn't it? Thank you again!

myke_deabreu
Level 8

Re: Showing image from Sharepoint attachments

Anytime dmowry! Happy Apping