pnp / pnpjs

Fluent JavaScript API for SharePoint and Microsoft Graph REST APIs
https://pnp.github.io/pnpjs/
Other
752 stars 305 forks source link

MC791596 impact on save page #3096

Open seblhe opened 1 month ago

seblhe commented 1 month ago

Major Version

4.x

Minor Version Number

1.0

Target environment

All

Additional environment details

I'm using NodeJs (18.20.3) and PnPjs(4.3.0)

Expected or Desired Behavior

With the MC791596 the Title area is not mandatory since july, there is a new webPart Banner with the same wePart Id as Title area. If I a create a page with the new webPart Banner which is not mandatory and then use PnPJs to save the page,

Observed Behavior

PnPJs add the Title area webpart so I get 2 page headers. Which is surprising is that we can't get with PnPjs the Title Area webpart added with PnPJs

Steps to Reproduce

import { spfi } from "@pnp/sp"; import { IClientsidePage } from "@pnp/sp/clientside-pages";

const sp = spfi(...);

// our page instance const page: IClientsidePage = await sp.web.loadClientsidePage("/sites/dev/sitepages/home.aspx");

// get the current value const value = page.bannerImageUrl;

// set the value page.bannerImageUrl = "/server/relative/path/to/image.png"; await page.save();

juliemturner commented 1 month ago

Thanks @seblhe that said we were waiting for an official pages API and although we got one it doesn't have all the features it needs to have so we're sadly still waiting. As we outline in our docs the solution we have is reverse engineered from the first party APIs and will break if anything changes on Microsoft's side. As you see that's coming to fruition which is why reverse engineering anything is a bad idea. Sadly, maintaining this code take a lot of work, and the team is very busy currently. I'll discuss it with the team and we'll see if/when we can take a look at this issue. Obviously, we're happy to take PR's from the community.

Bobinho4711 commented 3 weeks ago

HI @seblhe, did you maybe find an workaround for this issue?