SharePoint Online Provisioning PnP

At this weeks New Zealand Digital Workplace Conference I attended a session introducing the Provisioning PnP (Patterns and Practice) resources. This is a fantastic resource for SharePoint Online administrators and consultants.

It provides a set of PowerShell commands that allow administrators to build a template of a SharePoint Online site (or features within a site e.g just a library or list) and then redeploy the template to another site.

Three big features:

  • It isn’t tenant specific, so you can make a template from one tenant and deploy to another. Great for Dev to UAT to Production.
  • The templates can be updated and redeployed to update existing sites built from the template!
  • The templates are XML files that can be manually updated.

The Provisioning PnP also includes commands that can help audit sites, lists and libraries for specific settings. For example, you can find a list of sites with a specific feature enabled or web-part installed.

The Provisioning PnP is free and is part of a larger PnP resource which is receiving monthly updates.


This is a fantastic addition to the tool kit but wait there’s more. The PnP website is full of useful resources, created by experts for the community.

Thank you to Paul Culmsee for sharing his experiences with us at #DWCNZ.

Nintex Web Part Maintenance Page error

When applying a custom master page to our SharePoint site, we struck an issue with opening Nintex forms.

Sorry, something went wrong

An unexpected error has occurred.

Web Parts Maintenance Page: If you have permission, you can use this page to temporarily close Web Parts or remove personal settings. For more information, contact your site administrator.


After a bit of digging around with ULSviewer, we found this error in the SharePoint Log

Application error when access /site/Lists/ourlist/DispForm.aspx, Error=The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases.

at System.Web.UI.ControlCollection.Add(Control child) 

at Nintex.Workflow.Forms.ControlTemplates.ListForm.OnInit(EventArgs e) 

at System.Web.UI.Control.InitRecursive(Control namingContainer) 

at System.Web.UI.Control.InitRecursive(Control namingContainer) 

at System.Web.UI.Control.AddedControl(Control control, Int32 index) 

at Microsoft.SharePoint.WebPartPages.ListFormWebPart.CreateChildControls() 

at System.Web.UI.Control.EnsureChildControls() 

at Microsoft.SharePoint.WebPartPages.WebPart.get_WebPartMenu() 

at Microsoft.SharePoint.WebPartPages.ListFormWebPart.CreateWebPartMenu() 

at Microsoft.SharePoint.WebPartPages.ListFormWebPart.OnLoad(EventArgs e) 

at System.Web.UI.Control.LoadRecursive() 

at System.Web.UI.Control.LoadRecursive() 

at System.Web.UI.Control.LoadRecursive() 

at System.Web.UI.Control.LoadRecursive() 

at System.Web.UI.Control.LoadRecursive() 

at System.Web.UI.Control.LoadRecursive() 

at System.Web.UI.Control.LoadRecursive() 

at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

The problem was definitely master page related, because it didn’t occur when we switched back to the default SharePoint master page.

The solution:

In the custom master page, look for the following code.

Move this code block from the Header in to the Body of the master page

<!–MS:<SharePoint:AjaxDelta id=”DeltaSPWebPartManager” runat=”server”>–>
<!–MS:<WebPartPages:SPWebPartManager runat=”server”>–>

Try opening the Nintex form again and with any luck your error will go away.

I believe this issue happens because Nintex forms ignore the header part of the master page. Someone with more developer knowledge than me might be able to explain further.


The HTML master page SPWebPartManager position can also be part of the problem. Make sure this is positioned in the <body> section too. I noticed that if this was in the wrong place, it could cause the error above for all users except Site Collection Admins.

See the reference section of this MSDN article for an example of correctly format HTML

How to: Convert an HTML file into a master page in SharePoint 2013


SharePoint Blog Comments Alert

I was asked recently how to setup an alert on a SharePoint blog so that the author of the blog would be notified when someone made a comment. Here is the solution, built with a SharePoint Designer workflow.

Before we begin, I’ll give a quick explanation of how the SharePoint blog is structured. SharePoint uses two lists to implement blogs and comments.

  • Posts contains the blog post with details including the blog post text, author, date, number of comments and number of likes
  • Comments contains the comment and is linked back to the Posts list via a lookup column

Building the workflow:

In SharePoint Designer, create a new Workflow on the Comments list in the blog site. Configure the workflow to run when a new item is created.

  1. Create a workflow variable to store the Created By column of the blog post associated with the comment. This is done using a lookup field.

Screen Shot 2015-11-28 at 6.17.34 pm.png

2. Create an email using the variable created in step 1 in the “To” field of the Workflow email template. You can also enter the name of the blog post.

Screen Shot 2015-11-28 at 6.21.08 pm.png

That’s it! Now anytime someone makes a comment on the blog, the author of the blog will receive an email notification.

This solution will work for SharePoint 2010, 2013 and SharePoint Online.


Migrating the SharePoint Content Type Hub

Microsoft Introduced the Content Type Hub (CTH) in SharePoint 2010.  It allows the central management of Content Types access multiple Site Collections. Content Types are defined and configured in the CTH and published to other site collections.

I have recently migrated several SharePoint 2010 environments with Content Type Hubs to SharePoint 2013. The documentation on how to do this is a bit patchy hence this post.

Migrating the Content Type Hub

The Content Type Hub is dependent on the Managed Metadata Service.

  1. Restore the Managed Metadata database and Content Type Hub content databases to the SQL Server used by your SharePoint 2013 farm.
  1. Create a site collection for the Content Type Hub using the database restored in step 1.
  1. Use the following PowerShell script to create a new Managed Metadata Service. Replace the database name with the name of the database restored in step 1.
$applicationPool = Get-SPServiceApplicationPool -Identity "Managed Metadata Service Application"
$mms = New-SPMetadataServiceApplication -Name "Managed Metadata Service
Application" -ApplicationPool $applicationPool -DatabaseName "SP_MMDS_Database"
New-SPMetadataServiceApplicationProxy -Name " Managed Metadata Proxy" -ServiceApplication $mms -DefaultProxyGroup
  1. If the URL of your SharePoint 2013 web application is different to SharePoint 2010 you will need to update the URL in the Properties of the Managed Metadata Service Application using this PowerShell.
Set-SPMetadataServiceApplication –Identity “Managed Metadata Service Application” –HubURI http://yoursharepointsite/CTH

This will update the URL in the Properties page. Note that doing this will make all Content Types “unpublished” and you will need to republish them.

More tips:

The SharePoint Timer Jobs used to publish Content Types will have the default settings. If you want to publish / synchronise more frequently you should change these settings in Central Admin \ Monitoring \ Job Definitions. Look at the settings on these jobs:

  • Content Type Hub
  • Content Type Subscriber

Test publishing by going to the Content Type Hub and republishing a Content Type. If you get an error ‘No valid proxy can be found to do this operation- publishing of content type‘, check the URL of the CTH in the Managed Metadata Service properties.