In Sharepoint Online, I have moved a lot of sites with their subsites and pages using the Site manager tool. But the image links are now broken with url's pointing to the old, now invalid, location.

However, if I use CSOM to retrieve the PageListItem string currentHtml = pageListItem["PublishingPageContent"]?.ToString(); I get what I suppose is the latest version, with links that are working.

Also, if I retrieve all the Versions using CSOM I get 3 versions. And version 3 contains links that are working.

If I go to Sharepoint and look at Version History for the same page I can see the 3 versions. The latest version has links that are working.

Ribbon->Page->Page History is OK.

Ribbon->Page shows that the page is not checked out.

Ribbon->Page->Preview is OK.

If I Edit the page, the new version appears with working links. If I click Save without doing any changes, the page is fixed.

In conclusion, moving the page seems to have overwritten the latest version (3) with new image links. The page containing the old links is not in the version history. But Sharepoint does not show the new version 3 - instead it shows the old (broken) version 3 which is not in the history. Edit, Preview, View page history all display the new version 3.

How can I detect using CSOM if a page is in this state? Could this be a Sharepoint caching issue?

EDIT: I just found out that if I call Update() from CSOM:

 pageListItem.Update(); // send new html to sharepoint

the old broken version 3 overwrites the new version 3 everywhere.

  • Might it be a question of checked-out items? Maybe, after moving the items, all of them remained as checkedout. Try runing a simple powershell to checkin all items in a given library just to make sure this is the case.
    – Gonzix
    Oct 16, 2019 at 13:38
  • The page is not checked out, at least when I look at the Ribbon->Page tab
    – Rugbrød
    Oct 17, 2019 at 7:36


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.