question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Saving a page via PnP leads to duplicates of inline image webparts

See original GitHub issue

Category

  • Bug

Describe the bug

Microsoft recently added the ability, to add images inside a text webpart. Unfortunately PnP does not handle this new funcionality correctly.

I’ve created a new page with an image inside a text webpart. If I now load and save this page via PnP (without any modifications in between), the image appears twice on the page. The inline image is still in place inside the text webpart, but above the text webpart there is now an additional image webpart containing the same image. If I delete the added image webpart, also the inline image inside the text webpart disappears.

Steps to reproduce

  1. Create a new SitePage
  2. Add some text and an inline image to the existing text webpart
  3. Save the page via SharePoint UI
  4. Load and save the page without any modifications in between via PnP. Example code below (C#):
var context = await authProvider.GetContextAsync("https://mytenant.sharepoint.com/sites/testsite");
var page = context.Web.LoadClientSidePage("MyPage.aspx");
await page.SaveAsync();

Expected behavior

The page should not be modified at all, since we do not make any changes to it between loading and saving it via PnP. The image should not be duplicated.

Environment details (development & target environment)

  • SDK version: PnP.Core 1.4.0, PnP.Core.Auth 1.4.0, PnP.Framework 1.7.0
  • SDK used in: Azure Function, Console App
  • Framework: .NET Core 3.1, .NET 5
  • Tooling: Visual Studio 2022

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
frupprecht-nCcommented, Nov 29, 2021

Works great on my end, thank you very much!

1reaction
frupprecht-nCcommented, Nov 22, 2021

@jansenbe That’s great, thanks for the quick response and fix ☺

Read more comments on GitHub >

github_iconTop Results From Across the Web

Duplicate the same web part containing multiple quick links ...
Up on the top bar click the plus + next to "New" then select "copy this page" allows you to make a complete...
Read more >
Handling of inline images in text web part broken on export
I'm currently having the same issues adding inline images directly using PnP.PowerShell commands and having more or less the same issues.
Read more >
Inline Image duplicated after reuploading SharePoint's ...
I have a SharePoint Text WebPart with an inline image in it. I want to perform changes on the page and re-upload my...
Read more >
Working with modern client-side pages using PnP ...
We create a new view in the Document Library and set this as standard for the webpart, then run the above code one...
Read more >
SharePoint Framework (SPFx) Samples
This is a sample SharePoint Framework client-side web part built using Angular, illustrating building multi-page web parts.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found