Forum Discussion
Embed User Photo in SharePoint Rich Text Field
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: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.
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_RosarioSilver Contributor
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
- michaelkubalaBrass Contributor
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.
- michaelkubalaBrass Contributor
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.