cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Maurits
Level 8

How to display CDS attachment image?

Hi, hope somebody can help me. We add attachments like images to notes/annotations in the CDS.

There are great blogs on camera integration to do so. 

But I try to show the attached images in a PowerApp, which fails.

Found some blogs on how to show images from SharePoint lists attachments in a gallery, but somehow I can't get this to work with the CDS attachment. 

I receive the attachment.body with the textual content.

Is there a way to assign this to a image object or so?

 

Maurits

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Maurits
Level 8

Re: How to display CDS attachment image?

Solved it. FYI if someone else want to do the same:

Apparently the data stored with the attachments are not complete because the Canvas App used deletes the first part of it. Otherwise the result would't be usable jpg or png files.
When showing these files, the removed part of the text must be added first.
E.g. see code below when using the Notes entity.

 

Switch(
    Right(
        ThisItem.'File Name';
        3
    );
    "png";
    Concatenate(
        "data:image/png;base64,";
        ThisItem.Document
    );
    "jpg";
      Concatenate(
        "data:image/jpg;base64,";
        ThisItem.Document
    )  
)

View solution in original post

1 REPLY 1
Highlighted
Maurits
Level 8

Re: How to display CDS attachment image?

Solved it. FYI if someone else want to do the same:

Apparently the data stored with the attachments are not complete because the Canvas App used deletes the first part of it. Otherwise the result would't be usable jpg or png files.
When showing these files, the removed part of the text must be added first.
E.g. see code below when using the Notes entity.

 

Switch(
    Right(
        ThisItem.'File Name';
        3
    );
    "png";
    Concatenate(
        "data:image/png;base64,";
        ThisItem.Document
    );
    "jpg";
      Concatenate(
        "data:image/jpg;base64,";
        ThisItem.Document
    )  
)

View solution in original post

Helpful resources

Announcements
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (6,435)