SOLVED

Embed User Photo in SharePoint Rich Text Field

%3CLINGO-SUB%20id%3D%22lingo-sub-971846%22%20slang%3D%22en-US%22%3EEmbed%20User%20Photo%20in%20SharePoint%20Rich%20Text%20Field%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-971846%22%20slang%3D%22en-US%22%3E%3CP%3EI'm%20trying%20to%20write%20to%20a%20rich%20text%20field%20in%20SharePoint%20from%20PowerApps.%20I'm%20writing%20the%20following%20to%20the%20field%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CTABLE%3E%3CTBODY%3E%3CTR%3E%3CTD%3E%3CIMG%20src%3D%22%26quot%3B%26quot%3B%26quot%3B%22%20%2F%3E%3C%2FTD%3E%3CTD%3E%22%20%26amp%3B%20User().FullName%20%26amp%3B%20%22%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20User().Image%20converts%20the%20picture%20to%20base64%20correctly%3A%20%22data%26amp%3Bcolon%3Bimage%2Fpng%3Bbase64%2CiVBORw0KGg%20....%22%2C%20but%20when%20this%20is%20written%20to%20the%20rich%20text%20field%2C%20it%20gets%20written%20as%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CIMG%20data-themekey%3D%22%26quot%3B%23%26quot%3B%22%20alt%3D%22%26quot%3B%26quot%3B%2F%22%20%2F%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhy%20is%20SharePoint%20or%20PowerApps%20converting%20my%20img%20tag%20and%20removing%20the%20picture%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20I%20take%20the%20actual%20base64%20image%20tag%20and%20manually%20enter%20it%20into%20the%20rich%20text%20field%2C%20it%20shows%20up%20correctly%20so%20I%20know%20this%20can%20work%2C%20but%20there%20is%20something%20weird%20going%20on%20with%20the%20Patch%20call.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-971846%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EPowerApps%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-987161%22%20slang%3D%22en-US%22%3ERe%3A%20Embed%20User%20Photo%20in%20SharePoint%20Rich%20Text%20Field%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-987161%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F421392%22%20target%3D%22_blank%22%3E%40michaelkubala%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAs%20far%20as%20I%20know%2C%20you%20can't%20do%20what%20you%20are%20trying%20to%20do%20from%20PowerApps.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHowever%2C%20a%20ton%20of%20experts%20sit%20in%20another%20Microsoft%20forum%20dedicated%20towards%20PowerApps%2FFlow.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fpowerusers.microsoft.com%2Ft5%2FPowerApps-Community%2Fct-p%2FPowerApps1%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fpowerusers.microsoft.com%2Ft5%2FPowerApps-Community%2Fct-p%2FPowerApps1%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMaybe%20check%20if%20the%20experts%20there%20have%20any%20other%20ideas%3F%20If%20you%20figure%20it%20out%2C%20I'd%20be%20interested%20in%20a%20solution%20but%20it's%20my%20belief%20that%20it's%20a%20product%20limitation%20at%20this%20time.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECheers%20and%20best%20wishes%3C%2FP%3E%3CP%3EDamien%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-989863%22%20slang%3D%22en-US%22%3ERe%3A%20Embed%20User%20Photo%20in%20SharePoint%20Rich%20Text%20Field%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-989863%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F89704%22%20target%3D%22_blank%22%3E%40Damien%20Rosario%3C%2FA%3E%26nbsp%3Bthanks%20for%20the%20follow%20up.%20I'll%20check%20out%20the%20other%20forum%2C%20but%20I%20think%20I%20agree%20with%20your%20assessment%20that%20this%20may%20just%20be%20a%20product%20limitation.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-995286%22%20slang%3D%22en-US%22%3ERe%3A%20Embed%20User%20Photo%20in%20SharePoint%20Rich%20Text%20Field%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-995286%22%20slang%3D%22en-US%22%3E%3CP%3EFor%20anyone%20interested%2C%20you%20can%20only%20embed%20pictures%20if%20you%20point%20the%20src%20attribute%20to%20an%20actual%20location%20rather%20doing%20trying%20to%20embed%20the%20base64%20image.%20In%20my%20case%2C%20I%20was%20able%20to%20point%20to%20the%20user's%20photo%20by%20using%20the%20following%20in%20my%20Patch%20call.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3E%22%3CIMG%20src%3D%22%26quot%3B%26quot%3B%26lt%3BA%22%20href%3D%22https%3A%2F%2Foutlook.office365.com%2Fowa%2Fservice.svc%2Fs%2FGetPersonaPhoto%3Femail%3D%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Foutlook.office365.com%2Fowa%2Fservice.svc%2Fs%2FGetPersonaPhoto%3Femail%3D%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Foutlook.office365.com%2Fowa%2Fservice.svc%2Fs%2FGetPersonaPhoto%3Femail%3D%3C%2FA%3E%22%20%26amp%3B%20User().Email%20%26amp%3B%20%22%26amp%3BUA%3D0%26amp%3Bsize%3DHR48x48%22%20%2F%26gt%3B%22%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EFor%20the%20%22HR48x48%22%20part%2C%20you%20can%20use%2048%2C%2096%20or%20just%20leave%20it%20out.%20Those%20are%20the%20only%20options%20I%20got%20to%20work.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1032559%22%20slang%3D%22en-US%22%3ERe%3A%20Embed%20User%20Photo%20in%20SharePoint%20Rich%20Text%20Field%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1032559%22%20slang%3D%22en-US%22%3E%3CP%3ENice%20one%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F421392%22%20target%3D%22_blank%22%3E%40michaelkubala%3C%2FA%3E!%20The%20other%20forum%20is%20awesome%20isn't%20it%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECheers%3C%2FP%3E%3CP%3EDamien%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
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
Highlighted
Best Response confirmed by michaelkubala (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

Highlighted

@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. 

Highlighted

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. 

 

 

Highlighted

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

 

Cheers

Damien