Modernize your SharePoint pages: March update

SharePoint team

Modernization overview

SharePoint Online is continuously evolving and improving, which is a great thing for you as a consumer of the service. One of the key features is the availability of modern sites, which are modern Office 365 group-connected team sites or communication sites, combined with improved functionality that can be consumed from a beautiful, responsive, modern user interface. To learn more about modern checkout the SharePoint classic and modern experiences article and get inspired by the SharePoint Look Book.

All of this is great, but you might ask yourself, I have lots of classic (team) sites…how do I bring them into the modern SharePoint world? The answer is (in-place) modernization: you can fully transform (or “modernize”) a classic site team sites into modern, optionally Office 365 group-connected, sites by following the SharePoint modernization guidance. Check out the Modernize your SharePoint pages blog post to learn more about the page modernization basics.

A key part of modernizing your sites is transforming your wiki and web part pages into modern client-side pages. This transformation is possible using the SharePoint PnP Modernization framework, which is a .Net library that you can use via either .Net code, PnP PowerShell or the Page Transformation UI tool.

March 2019 updates

The March release of the SharePoint PnP Modernization framework contains several major improvements. The March release is available via:

Cross-site page transformation

The default page transformation behavior is to create the modern client-side pages in the same site as the source wiki or web part page, but now you can also create the modern client-side page in another, modern, site collection (e.g. a communication site). During a cross-site page transformation, dependent media assets (images, videos) are copied from the source site collection to the sitepages library in the target site collection.

Using PnP PowerShell

When using PnP PowerShell you can specify the url of the target site collection via the TargetWebUrl parameter.

# Connect to the site with pages to modernize 
Connect-PnPOnline -Url https://contoso.sharepoint.com/sites/ateamsite 
# Modernize page1.aspx and create the resulting modern client side page in another site 
ConvertTo-PnPClientSidePage -Identity page1.aspx -TargetWebUrl https://contoso.sharepoint.com/sites/acommunicationsite
Using .Net

When using .Net you need to create a ClientContext object instance for the target web and specify that in the PageTransformator constructor as shown in below code snippet.

var pageTransformator = new PageTransformator(sourceClientContext, targetClientContext); 
var pages = clientContext.Web.GetPages(); 
foreach (var page in pages) 
{     
  PageTransformationInformation pt = new PageTransformationInformation(page)     
  {         
    // If target page exists, then overwrite it         
    Overwrite = true,     
  };     
  pageTransformator.Transform(pt); 
}
Note:

Not all web parts are supported for a cross-site transfer. More web parts will be enabled in upcoming releases, check out the Cross-site support column in web part transformation list to learn more.

New and improved web part transformations

The following web parts are now transformed as well. Check out the web part transformation list to get an overview of which web parts are transformed and how.

  • NEW: ContentBySearchWebPart and ResultScriptWebPart are transformed to the Highlighted Content web part
  • NEW: ContactFieldControl is transformed into the People web part
  • UPDATE: SummaryLinks now by default goes to the QuickLinks web part, optionally transformation to HTML is still possible
  • UPDATE: ContentByQueryWebPart better supports site and site collection scoped queries
  • UPDATE: The toolbar visibility setting from an XSLTListViewWebPart is now taken over to the respective modern List and Library web parts
  • UPDATE: ContentEditorWebPart now reads content from linked files (e.g. html) file and transforms these as HTML on the page

Other improvements

Other key improvements are:
  • Empty text parts (so parts having HTML without visual content) are now dropped
  • The new configuration option RemoveEmptySectionsAndColumns is on by default and will remove all empty sections and columns from a transformed page. This will result in cleaner pages that better use the available screen estate
  • No need anymore to update the mapping file if you want to use the community script editor web part in your transformation: the mapping file behavior can be configured using mapping properties. For PnP PowerShell usage you specify the UseCommunityScriptEditor switch, for .Net set a mapping property on the PageTransformationInformation instance (MappingProperties[“UseCommunityScriptEditor”] = “true”;)

Resources

“Sharing is caring”

 


SharePoint Team, Microsoft  – 13th of March 2019

Feedback usabilla icon