Office-docs-powershell: Add-PnPClientSideText adding html code not parsing base64 encoded images

Created on 15 Feb 2019  Â·  7Comments  Â·  Source: MicrosoftDocs/office-docs-powershell

Hi all,

I am trying to create new pages in SharePoint Online with the command Add-PnPClientSideText and successfully inserted html code with the text parameter like _Add-PnPClientSideText -text _. Now I am also trying to insert images which are base 64 encoded, e.g.
<img src="data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUA AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO 9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />.
Sadly, this code seems to be ignored?! As a result, in the source code of the established site there is an empty image tag like <img alt="Red dot" />.

Is there a workaround or am I doing something wrong?
Thanks in advance!

pnp-powershell

All 7 comments

Inserting Images is not implemented in the Add-PnPClientSideText. I had the same requirement and what I have done is replaced the with an Image Web part using -
Add-PnPClientSideWebPart -Page $pageWhereImageWPhastoBeAdded -DefaultWebPartType Image -WebPartProperties @{imageSource=$imageSrc}

Inserting Images is not implemented in the Add-PnPClientSideText. I had the same requirement and what I have done is replaced the with an Image Web part using -
Add-PnPClientSideWebPart -Page $pageWhereImageWPhastoBeAdded -DefaultWebPartType Image -WebPartProperties @{imageSource=$imageSrc}

@ravinleague It's working! Thank you!!

But how do you change the image after adding it ?

On Mar 18, 2019 at 6:49 pm,

Inserting Images is not implemented in the Add-PnPClientSideText. I had the same requirement and what I have done is replaced the with an Image Web part using -
Add-PnPClientSideWebPart -Page $pageWhereImageWPhastoBeAdded -DefaultWebPartType Image -WebPartProperties @{imageSource=$imageSrc}

@ravinleague (https://github.com/ravinleague) It's working! Thank you!!

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub (https://github.com/MicrosoftDocs/office-docs-powershell/issues/2822#issuecomment-473820287), or mute the thread (https://github.com/notifications/unsubscribe-auth/AR3Y_M2wnYuilKCCOhrqhY_HOK07YUQoks5vX1MAgaJpZM4a9yHm).

@officedocsbot assign @yogkumgit

Hello @cbadouin thanks for your feedback.
As @ravinleague suggested and note that you already tried, you can use an Image webpart to accomplish that.
@ravinleague to update the webpart's image you could use Set-PnPClientSideWebPart with the PropertiesJson parameter
We will proceed closing this issue as this has no impact on documentation.
Thank you.

@get-itips Thank you very much for the contribution and sharing this explanation. @cbadouin
Hope this comment is helpful for you. Thanks for taking out some time to open the issue. Appreciate and encourage you to do the same in future also.

@officedocsbot close

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andikrueger picture andikrueger  Â·  5Comments

KevinNSTA picture KevinNSTA  Â·  4Comments

SamCosby picture SamCosby  Â·  5Comments

CallMeByMyName picture CallMeByMyName  Â·  5Comments

KoenZomers picture KoenZomers  Â·  3Comments