SOLVED

Embed User Photo in SharePoint Rich Text Field

Brass Contributor

I'm trying to write to a rich text field in SharePoint from PowerApps. I'm writing the following to the field:

 

<table><tr><td><img src=""" & User().Image & """ /></td><td>" & User().FullName & "</tr></table>

 

The User().Image converts the picture to base64 correctly: "data&colon;image/png;base64,iVBORw0KGg ....", but when this is written to the rich text field, it gets written as 

 

<img data-themekey="#" alt=""/>

 

Why is SharePoint or PowerApps converting my img tag and removing the picture?

 

If I take the actual base64 image tag and manually enter it into the rich text field, it shows up correctly so I know this can work, but there is something weird going on with the Patch call. 

4 Replies
best response confirmed by michaelkubala (Brass Contributor)
Solution

Hi @michaelkubala 

 

As far as I know, you can't do what you are trying to do from PowerApps.

 

However, a ton of experts sit in another Microsoft forum dedicated towards PowerApps/Flow.

 

https://powerusers.microsoft.com/t5/PowerApps-Community/ct-p/PowerApps1

 

Maybe check if the experts there have any other ideas? If you figure it out, I'd be interested in a solution but it's my belief that it's a product limitation at this time.

 

Cheers and best wishes

Damien

@Damien Rosario thanks for the follow up. I'll check out the other forum, but I think I agree with your assessment that this may just be a product limitation. 

For anyone interested, you can only embed pictures if you point the src attribute to an actual location rather doing trying to embed the base64 image. In my case, I was able to point to the user's photo by using the following in my Patch call.

 

"<img src=""https://outlook.office365.com/owa/service.svc/s/GetPersonaPhoto?email=" & User().Email & "&UA=0&size=HR48x48" />"

 

For the "HR48x48" part, you can use 48, 96 or just leave it out. Those are the only options I got to work. 

 

 

Nice one @michaelkubala! The other forum is awesome isn't it?

 

Cheers

Damien

1 best response

Accepted Solutions
best response confirmed by michaelkubala (Brass Contributor)
Solution

Hi @michaelkubala 

 

As far as I know, you can't do what you are trying to do from PowerApps.

 

However, a ton of experts sit in another Microsoft forum dedicated towards PowerApps/Flow.

 

https://powerusers.microsoft.com/t5/PowerApps-Community/ct-p/PowerApps1

 

Maybe check if the experts there have any other ideas? If you figure it out, I'd be interested in a solution but it's my belief that it's a product limitation at this time.

 

Cheers and best wishes

Damien

View solution in original post