Modern SharePoint Page | wrong architectural concept or BUG

Copper Contributor

Hello guys

For a HR request in my company, I have to develop a specific webpart to replace the OOTB header webpart in modern page (the one containing the title and header banner image).


But this is not working at all.


My webpart allows people to edit page title and the banner itself.



It is using the following rest SharePoint api endpoints to persist the updates : 

1. /_api/sitepages/pages({pageId})/checkoutpage to get the page content at the loading of the page

2. /_api/sitepages/pages({pageId})/savepage to persist my changes when updating title or banner image

(1) is done the at the loading of the page

(2) is called each time title or banner image changed


Information are well persisted in the back, so as soon as I stay on the page edition mode, if i open the page in another tab, the page will reflect my changes. But as soon I clicked on "Publish button" in the edition page, then my changes are replaced by the one from Microsoft... even if the process (edition title or image) looks the same in Fiddler.




Explanation of picture above 
- In green the process done in OOTB Header webpart from MS 

1. Bullet (1) when I edit the title it is calling save endpoint 

- In yellow the process done in my webpart

1. Bullet (1) when I edit the title it is calling save endpoint 


Bullet (2) when I click on Microsoft publish button in the edition page (top right button), the process is the same as this is not related to both webpart. 


The problem is when you are clicking on the publish button, it does not refresh the page content according to my changes, that means Microsoft is calling save endpoint with previous data (the one retrieved at the loading of the page)... so whatever I am doing in my webpart, when I click on publish, Microsoft is overwriting my changes with the old one even if in the meantime my webpart did update the page title or banner image, as you can see in the gif below, the call to savepage from publish button overrides my title.  



0 Replies