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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Download a picture sto...
Power Apps
Answered

Download a picture stored in SharePoint list from PowerApps

(0) ShareShare
ReportReport
Posted on by 25

I have an app where users take a picture using the camera control, and submit it to a Sharepoint list.

 

I want them to be able to download the image when they click on it. I want to replicate what happens when you go into the Sharepoint list directly and click on the image (it opens on the browser and users can download it).

Categories:
I have the same question (0)
  • mlockett Profile Picture
    14 on at

    1. Create a Gallery populated from the SharePoint Connector sourced from the associated SharePoint list housing the images.

    2. In the gallery control, insert a button with the Submit action using Launch(ThisItem.File name with extension) SharePoint field.

    3. Bring in any other fields you want to view in the record for context

     

    This allows users to see all SharePoint records and quickly open the associated record's image with one click. Let me know if this does not answer your question.

  • Data555 Profile Picture
    25 on at

    When I do this I get "**** is unreachable"

  • mlockett Profile Picture
    14 on at

    Sorry - I misspoke. The correct SharePoint field name to pull is "Link to item" and you need a Lookup function on the gallery item (button or label). So, please try the following instead for the OnSelect event of that gallery item. Note: Replace the <enter SP connection> with your specific SharePoint connection name. Let me know!

     

    Launch(

       Lookup (<enter SP connection>,

          ID = ThisItem.ID

       ).'Link to item'

    )

  • Data555 Profile Picture
    25 on at

    It takes me to the Sharepoint item but it does not open just the picture.

    It opens the items with all the fields

  • Verified answer
    mlockett Profile Picture
    14 on at

    I just mocked up the solution and it works fine. Clicking on a label from the gallery opens the associated JPG image in a new browser tab as expected.  My gallery's datasource is a SP document repository.  I have a LABEL field in the gallery with it's "Text" property set to, "ThisItem.'File name with extension', that shows, "Image1.jpg" when run. The OnSelect action is as earlier communicated (see below for reference)

     

    Launch(

       Lookup (<enter SP connection>,

          ID = ThisItem.ID

       ).'Link to item'

    )

  • Data555 Profile Picture
    25 on at

    Perhaps it's because you are using a SP Document Library and I am using a list. Technically your solution works, so I'll close the thread. I can use this to get to the item and download the image. 

  • LautaroLopez Profile Picture
    36 on at

    Hi, how do i get the "  'Link to Item'  " in my sharepoint list

     

    Thx

  • mathornton Profile Picture
    on at

    I figured out how to do this! 

     

    First, go to your SharePoint list and click on the images stored there to view them in separate tab (doing this in PowerApps is the end goal). Now look at the URL in your browser for the image open in it's own tab. We need to be able to identify that URL within PowerApps and then use download("imageURL") or launch("imageURL"), they seem to do the same thing in this case. If you look at several images in your list you will find there is a pattern to the URLs. You can essentially break it into five pieces:

    1. The list's address
    2. The list item ID
    3. The column name
    4. The filename (Will look like gibberish if photo was added through PowerApps. if you enter it in lists it will retain the original filename.)
    5. The filetype

    Example:

     "https://ListAddress/Attachments/ItemID/Reserved_ImageAttachment_%5B5%5D_%5BColumnName%5D%5B36%5D_%5BFileName%5D%5B1%5D_%5B1%5DFileType"

     

    Everything before the ItemID will be the same every time so just copy that part and store it in your app somewhere. 

    The ItemID can easily be found in PowerApps with "ThisItem.ID".

    Everything from the ItemID to the FileName doesn't appear to change either so just copy and store that part too.

    Store the section between FileName and FileType as well.

     

    Getting the FileName is the trickiest part. Create a label and set the "Text" property to "ThisItem.ColumnName.Full". This will output a wall of text, but inside that wall is the FileName and FileType. I spent some time looking for patterns to determine how to slice the FileName out. Yours may be different but I'll share what I did (Label1 holds "ThisItem.ColumnName.Full").

    In Label2's Text property I put "Left(Right(Label1.Text,(Len(Label1.Text) - (Find("6%25255d_%25255b",Label1.Text) + Len("6%25255d_%25255b")) + 1)),36)"

    This outputs the FileName.

    Next we get the FileType. This can also be pulled from our label containing "ThisItem.ColumnName.Full". Here is how I did it.

    In Label5's Text property I put: "Right(Label1.Text,(Len(Label1.Text) - (Find("%25255d.",Label1.Text) + Len("%25255d.")-2)))"

    In Label6's Text property I put: "Left(Label5.Text,Find("%2Fthumbnails%",Label5.Text)-1)"

    This outputs the FileType.

     

    Finally we put it all together in Label4:

    "Concatenate("ListAddress/Attachments/",ThisItem.ID,"/Reserved_ImageAttachment_%5B5%5D_%5BColumnName%5D%5B36%5D_%5B",Label2.Text,"%5D%5B1%5D_%5B1%5D",Label6.Text)"

     

    Now if you put launch(Label4.Text) into the OnSelect property of a button it will open your image in a new tab. Probably not the cleanest solution but it shows that it CAN be done.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard