Download images in SharePoint column | Canvas Apps | Power Apps | SharePoint lists

Table of Contents

Working with images stored in a SharePoint list column is a common scenario for Canvas Apps in Power Apps. In this guide, we’ll walk you through how to download images in SharePoint columns, directly from your Canvas App.

Use case description

We have an image-type column in SharePoint:

We want to allow users to download this picture from a Canvas Apps app that is connected to the SharePoint list:

Automate tasks that slow you down

Free up your team’s time and focus on strategic work with digital and robotic automation.

Solution description

When we inspect the column in our SharePoint list and click on an image to view it in a separate browser tab this is the URL structure when viewing in the browser:

{SharePointSiteAndListAddress}/Attachments/{ItemID}/Reserved_ImageAttachment_%5B5%5D_%5B{ColumnName}%5D%5B36%5D_%5B{FileName}%5D%5B1%5D_%5B1%5D{FileType}

If we get the value of an image column in Power Apps, we get the following:

Note how in the middle of all the text, Power Apps uses the very same SharePoint URL format:

The
text we need is in between the key words:

·        
attachments

·        
thumbnails

Below is the code needed to
extract the URL and provide Power Apps a link to display the image and allow
user to download:

				
					Download("https://wearepowergi.sharepoint.com/sites/BootcampDemos/Lists/UsuarioActuales_Marvin/Attachments/"&RecordsGallery1.Selected.ID&"/"&Substitute(
   Substitute(
        //extract image path
       First(Split(Last(Split(RecordsGallery1.Selected.Fotografia.Full,"%2Fattachments%28%27")).Value,"%27%29%2Fthumbnails%")).Value,
       //replace special characters.
       "%25255b","["),
   "%25255d","]"
)
)
				
			

Replace:

  • SharePoint Address
  • List Name
  • ItemID
  • Item and Column Name

Add above code in the OnSelect action of the download button.

After this is done we can test and run the app to make sure all works properly!

Are you ready to discover the joy of automation?

Whether you have a project in mind or just want to know how we can help, we’re happy to have a conversation

How our Power Apps Development services can help

Using our Power Apps and Power Platform consulting services, we have designed and implemented many Canvas Apps, covering many scenarios and business cases, contact us, we’ll be more than happy to have a conversation and see how we can be of help for your team.

Author
Power Platform Consultant | Business Process Automation Expert
Microsoft Certified Power Platform Consultant and Solution Architect with 4+ years of experience leveraging Power Platform, Microsoft 365, and Azure to continuously discover automation opportunities and re-imagine processes.