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 context.ExecuteQuery();
the old broken version 3 overwrites the new version 3 everywhere.