pnp / PnP-Sites-Core

Microsoft 365 Dev PnP Core component (.NET) targeted for increasing developer productivity with CSOM based solutions.
Other
415 stars 642 forks source link

After transform source wiki page will be blank #2052

Open LeoJiang1988 opened 5 years ago

LeoJiang1988 commented 5 years ago

Category [X ] Bug [ ] Enhancement

Environment [X ] Office 365 / SharePoint Online

First use PNP method AddWebPartToWikiPage add webpart to wiki page, then use API Transform wiki page to Modern page. After this step, the source wiki page will be blank.

Through the code, we found the mehtod AddWebPartToWikiPage use webpart.id in WikiField column value. But SharePoint UI add webpart use webpart storagekey.

The webpart.StorageKey only support in Server API.

The SwapPages method in PageTransformator.cs use File.Copyto will cause this issue.

jansenbe commented 5 years ago

Hi @LeoJiang1988,

So you only have the issue when you create the wiki page using the PnP AddWebPartToWikiPage method and then convert it. A manually created Wiki page in the UI does work fine. Is this correct?

LeoJiang1988 commented 5 years ago

Hi @jansenbe ,

Yes, correct.

why not change the CopyTo to MoveTo. Look like code use CopyTo for navigation, but code have fix navigation link function.

Best Regards!

jansenbe commented 5 years ago

Thx for the confirmation.

Once you use MoveTo SharePoint will also remove the navigation links that pointed to the page before the move. We use CopyTo and the whole approach in "swappages" to avoid losing these links.

jansenbe commented 5 years ago

Hi @LeoJiang1988,

I did some more checking and what I've noticed that SPO seems to close the web parts added via the AddWebPartToWikiPage method. This is something that used to work in the past.

As this is not an issue with page transformation I'm moving this issue to the PnP Sites core repository.

jansenbe commented 5 years ago

Also see #2048