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 SP column typ...
Power Apps
Unanswered

Download SP column type "Image" with a click in a download icon

(0) ShareShare
ReportReport
Posted on by 48

Hi!

 

I'm trying to make a download function in a download icon but with no sucess. How the SP column type "Image" and the app look alike is in the attachment.

 

I've tried this in the Icon "OnSelect":

 

Download(Thisitem.'Imagem um')

 

 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    Hi @powerapps2024 ,

    You cannot download it as it is not stored as a file - only a field with the file content in it. If you put in an Image Control (you can hide it) - in the Data Card with

    ThisItem.'Imagem um'.Full

    you can email it back to the user with

    Office365Outlook.SendEmailV2(
     User().Email,
     "Your Subject here",
     "Your Body here",
     {
     Attachments:
     {
     ContentBytes: YourImageControlName.Image,
     Name: "YourFileName.jpg"
     }
     }
    )

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

  • TuongDoan Profile Picture
    573 Moderator on at

    You can get direct link of an image in image column via flow:

     

    Screenshot 2024-04-27 at 12.29.32 PM.png

     

    Trigger input: Number (ID of item)

     

    Body of Parse JSON:

     

    {
     "type": "object",
     "properties": {
     "@@odata.context": {
     "type": "string"
     },
     "@@odata.etag": {
     "type": "string"
     },
     "createdDateTime": {
     "type": "string"
     },
     "eTag": {
     "type": "string"
     },
     "id": {
     "type": "string"
     },
     "lastModifiedDateTime": {
     "type": "string"
     },
     "webUrl": {
     "type": "string"
     },
     "createdBy": {
     "type": "object",
     "properties": {
     "user": {
     "type": "object",
     "properties": {
     "displayName": {
     "type": "string"
     },
     "email": {
     "type": "string"
     }
     }
     }
     }
     },
     "lastModifiedBy": {
     "type": "object",
     "properties": {
     "user": {
     "type": "object",
     "properties": {
     "displayName": {
     "type": "string"
     },
     "email": {
     "type": "string"
     }
     }
     }
     }
     },
     "parentReference": {
     "type": "object",
     "properties": {
     "id": {
     "type": "string"
     },
     "path": {
     "type": "string"
     },
     "listId": {
     "type": "string"
     },
     "siteId": {
     "type": "string"
     },
     "uniqueId": {
     "type": "string"
     }
     }
     },
     "contentType": {
     "type": "object",
     "properties": {
     "id": {
     "type": "string"
     },
     "name": {
     "type": "string"
     }
     }
     },
     "shared": {
     "type": "object",
     "properties": {
     "effectiveRoles": {
     "type": "array",
     "items": {
     "type": "string"
     }
     },
     "scope": {
     "type": "string"
     }
     }
     },
     "fields": {
     "type": "object",
     "properties": {
     "@@odata.etag": {
     "type": "string"
     },
     "ID": {
     "type": "string"
     },
     "Title": {
     "type": "string"
     },
     "field_6": {
     "type": "integer"
     },
     "field_8": {
     "type": "string"
     },
     "SampleImage": {
     "type": "string"
     },
     "imagecode": {
     "type": "string"
     },
     "ContentType": {
     "type": "string"
     },
     "Modified@odata.type": {
     "type": "string"
     },
     "Modified": {
     "type": "string"
     },
     "Created@odata.type": {
     "type": "string"
     },
     "Created": {
     "type": "string"
     },
     "AuthorLookupId": {
     "type": "string"
     },
     "EditorLookupId": {
     "type": "string"
     },
     "_UIVersionString": {
     "type": "string"
     },
     "Attachments": {
     "type": "boolean"
     },
     "Edit": {
     "type": "string"
     },
     "LinkTitleNoMenu": {
     "type": "string"
     },
     "LinkTitle": {
     "type": "string"
     },
     "ItemChildCount": {
     "type": "string"
     },
     "FolderChildCount": {
     "type": "string"
     },
     "_ComplianceFlags": {
     "type": "string"
     },
     "_ComplianceTag": {
     "type": "string"
     },
     "_ComplianceTagWrittenTime": {
     "type": "string"
     },
     "_ComplianceTagUserId": {
     "type": "string"
     }
     }
     }
     }
    }

     

     

     

     

    Body of Parse JSON 1, which will parse you image column:

     

    {
     "type": "object",
     "properties": {
     "fileName": {
     "type": "string"
     }
     }
    }

     

     

     

    Then in Power Apps,

     

     

    Download(Flow_Name.Run(ThisItem.ID).Your_Response)

     

     

    ---------------------------

    If the solution I provided assisted you in resolving this issue, kindly select "Accept as solution" This will help others in finding the solution more expediently 😄Also, a Thumbs up would be a great compliment!

  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    Hi @TuongDoan  ,

    I am curious - how does that download the file (it is still not an actual file). You are sending back the file content to Power Apps, which can be obtained directly by a simple Image control with (as I posted)

    ThisItem.'Imagem um'.Full

    however it did get me thinking of a much quicker way of creating a file to download. You can use any SharePoint Library for this - the Flow below is called DownloadFile

     

    WarrenBelz_0-1714203961833.png

    and using an Image control displaying as above, the Power Apps run code is

    Download(
     DownloadFile.Run(
     {
     file: 
     {
     contentBytes: YourImageControl.Image,
     name: "Test.jpg"
     }
     }
     ).filepath
    )

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • TuongDoan Profile Picture
    573 Moderator on at

    Hi @WarrenBelz ,

     

    My approach is to obtain the url of the actual image, not the binary. When you go to the list and click on the image, you will get the encoded URL to the file, so I try to recreate that link in Power Automate.

     

    It looks like this:

    https://XXXXX.sharepoint.com/sites/DEMO_PWAPP/_api/v2.1/sites('SITE_ID')/lists('LIST_ID')/items('ID')/attachments('Reserved_ImageAttachment_%5B11%5D_%5BSampleImage%5D%5B2%5D_%5Bbg%5D%5B1%5D_%5B8%5D.png')/thumbnails/0/c3000x2000/content?prefer=noredirect%2Cclosestavailablesize

     

    We can easily retrieve the Site ID and List ID, but we can't guess the file name because it will be changed and encoded by the system. In my flow, I call the SharePoint API and parse JSON twice to obtain the file name, then encode it. After constructing the URL, I send it back to Power Apps to download.

     

    The reasons I chose this approach are that:

    • Sometimes the method ThisItem.'Image Column'.Full/Medium/Small doesn't work as expected. I recently experienced this issue last week, it showed nothing.
    • Instead of rely on those default options, you can control the dimensions of the output file by changing the "c3000x2000" parameter. The system will resize the accordingly.
      • This can help control the detail of sensitive images. 
      • If the full image is super large and the app owner decided to display the small thumbnail, user can't download the full-size image. My flow can control that by passing the dimensions to the URL
    • We don't need to create a file each time someone downloads a file. In my example, I return the URL each time the user requests it, but you can save the URL to another column as text for later use. In the future, if anyone needs to download an image, just pass the generated URL into the Download function for faster retrieval. We can easily update the URL each time someone update the image by run the flow again (Trigger manually or automatically when the item was modified). So, the total effort of the system will be minimized and the speed will definitely faster.
    • Additionally, we don't need to worry about the security/permission aspect of the newly created file because it will be inherited from the row permission in SharePoint.
    • By the way, you won't have to clean up the temporary files created using your approach

     

    ---------------------------

    If the solution I provided assisted you in resolving this issue, kindly select "Accept as solution" This will help others in finding the solution more expediently 😄Also, a Thumbs up would be a great compliment!

     

  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    Hi @TuongDoan ,

    Yes that all might be true other than the temporary file as each item replaces the one before, but I would much rather guide a user with limited experience through my version . . .

  • TuongDoan Profile Picture
    573 Moderator on at

    Yes @WarrenBelz , your solution is much simpler and more straightforward. I believe it can be used by new users in most general cases. I just wanted to add another solution in case the app creator needs to comply with a company's strict policy.

     

    P/S: Sorry, I forgot that the file will be overridden 😄

     

    ---------------------------

    If the solution I provided assisted you in resolving this issue, kindly select "Accept as solution" This will help others in finding the solution more expediently 😄Also, a Thumbs up would be a great compliment!

     

  • powerapps2024 Profile Picture
    48 on at

    Hi @WarrenBelz ,

     

    Thanks for your reply!

     

    I couldn't get this download format to work that way.

     

    The way I managed was to create a column in SharePoint to place the SharePoint link that led to the image in each of the lines and place a button with the code:

    Launch(Gallery1.Selected.'LinkImage1')

    This way I can open the image in a new browser tab

  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    @powerapps2024 ,

    The problem is that is not the question you posted and @TuongDoan and myself spent quite a bit of time trying to help you with the potentially complex solution. Apart from that, are you saying you launched them from SharePoint manually then copied the URL of each one to an added field ? If so you might think about the future maintenance of that.

  • powerapps2024 Profile Picture
    48 on at

    @WarrenBelz ,

     

    That was exact what i did copy the URL's. I don't understand where to get the Image Control in the Data Card I tried with a edit form but with no sucess. Also tried the Power Automate with no sucess.

  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    @powerapps2024 ,

    You simply unlock the data card and put it in, with the Image property of (using your field name)

    ThisItem.YourImageField

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard