Bug with Save Site as a Template in SharePoint Online

We’ve hit a peculiar bug in SharePoint Online today when trying to “Save site as a template”. In this particular scenario we’re using composed looks to apply basic branding to SPO for a client. As composed looks can’t be inherited and we’re not looking to use code for provisioning, we decided to use site templates for each site collection.

We’re also using the Content Type Hub to push out a single document content type with the Enterprise keywords site column attached to it. To create the template, we’ve followed the process below:-

  1. Create content type in CTHub
  2. Add existing site column “Enterprise Keywords” to the content type.
  3. Browse to the main site collection and confirm content type deployment.
  4. Create new sub-site using the team site template.
  5. Customise and brand the template site
  6. Select “Save site as a template” in site settings
  7. Give it the relevant name/title, do NOT select “Include Content”

At this point, the save kicks off, but then throws a SharePoint error

clip_image001

If you browse to the solutions gallery in the site collection, you’ll find that the template has been saved as a new WSP, however the solution has not activated. If you try and manually activate, you’ll hit another SharePoint error.

When I was testing this earlier in the day I was actually receiving more detail on the error, with wording along the lines of:-

The validation of featuredefinition with id 16cfcf04-5543-4846-8b84-2ea93791ff5b has failed, file Phtest\ListInstances\ElementsContentType.xml, line 2029, token 118: The ‘AllowDeletion’ attribute is not declared

So, for some reason our WSP is failing feature validation, Looking into the Elements file specified, we can indeed see that our content type has the site column with the AllowDeletion=”True” value added.

clip_image002

Several others have been seeing this issue, including Renso Jacobs who helpfully pointed out on the MSDN forum post that is following this, that the FieldTypes reference document doesn’t show this AllowDeletion attribute in the FieldRef schema.

Removing this particular field from the content type is a quick and dirty workaround, it allows me to save the site as a template, and as I’m using the CTHub I can quickly redeploy the content types. However as soon as I do, the problem returns!

Now at the moment, I don’t have any content in this site as it’s a greenfield site, but the minute I do, removing a field from the content type is not an option as I’ll end up losing metadata.

I’ve confirmed that the issue currently affects builds 16.0.0.1205, 16.0.0.1210, 16.0.0.1216 and if I find any more I’ll let you all know and update the MSDN post. The issue is currently with Microsoft for investigation.

[important]UPDATE July 9th – This issue was accepted as a bug and escalated to the product team.[/important]

[important]UPDATE, the MSDN post has been updated to state that a hotfix has been globally rolled out across all tenancies. I ‘ve just tested and this is working now across all of my tenancies that were affected.[/important]

1 comment

  1. On a related note, watch out for another issue on this – with on-prem, if you save a site as a template, build a new site collection from it, then deactivate it from the solutions gallery, all Site scoped features (although still active) will become corrupted. At that point you’d need to deactivate/reactivate all site scoped features (there’s a few to keep you busy) to restore functionality, but I didn’t always find this 100% reliable. Instead, you should only deactivate the solution from ‘site collection features’, rather than the gallery, if you don’t want uses reusing the template for sub sites. This bug exists in SP2010 & SP2013, and Microsoft acknowledged it and sent it off as an ‘OFFBUG’ for the SP product group (which means I have a very low expectation that this will get fixed in my lifetime!). Ping me if you want to know more 🙂

Leave a Reply

Your email address will not be published.

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.