Scenario: You are working in a site collection where the root site was instantiated from a web template.  You have then created subsites which you wish to save as a web template.  Upon doing so, you receive an error.

Issue:

Error exporting the list named “Announcements” at the URL: Lists/Announcements

If you rename the list and try to save as a template again it will just give the same error with a different list, in alphabetical order.  When you look at the correlation ID you see:

SPSolutionExporter: System.NullReferenceException: Object reference not set to
an instance of an object.
at Microsoft.SharePoint.SPContentType.Serialize...

This is the one of the first lines in the log for your correlation ID.  When you look at the content types for your subsite, you see some of your custom content types but none of the defaults.  When looking at the root web for the site collection you see the same.

Resolution:

Run the SharePoint 2010 Management Shell as Administrator.  Run the following command to disable the default content type feature:

Disable-SPFeature –Identity ctypes –url http://SiteCollection

Then enable the content type feature:

Enable-SPFeature –Identity ctypes –url http://SiteCollection

If you look at your content types, they should now all be there.  Try saving the subsite as a template again, it should succeed.

14 Response Comments

  • AhmedFebruary 1, 2012 at 6:28 PM

    Thanks , Jonathan you saved my life !!! it works perfectly

    Reply
  • petkaApril 3, 2012 at 7:41 PM

    Thank you, saved my butt.

    Reply
  • Des OwenMay 2, 2012 at 8:35 AM

    Hi Jonathan

    I have seen this problem several times and I’m wondering if you know what causes it to happen in the first place. My client does not allow easy access to PowerShell so it can take a week to get the script run that fixes the problem but why would the content types disappear in the first place? I’m wondering if it’s related to the removal from the galery of the saved template used to create the site collection.

    Des Owen

    Reply
  • RicardoJune 1, 2012 at 7:24 AM

    Hello Jonathan

    I followed the steps you said but the problem remains.
    Also when I executed the Enable-SPfeature command iI had to add the force param otherwise I had an eror message “Content type with 0x Identifier defined at feature {xxxx}” was found at the current site collection …”

    ¿Any other ideas?

    Many thanks

    Reply
  • Hans LeonhardtJune 21, 2012 at 1:19 PM

    thanks a LOOOOOTTT .. great…

    Reply
  • JesseOctober 8, 2012 at 10:22 PM

    This worked perfectly. Really helped me out! Thanks!!!!

    Reply
  • HenrikOctober 26, 2012 at 9:14 AM

    Thanks, you saved us some time :)

    Reply
  • Jess GordonDecember 26, 2012 at 8:43 PM

    I tried your solution and it did not work for me. First, it took 3 tries to execute the Disable… command (timed out the first 2 tries) then ran. The Enable… ran right away.
    However when I went back to my sub-site to save it as a template, I threw an error on the same list.

    Any ideas?

    Reply
  • ErinFebruary 8, 2013 at 4:16 PM

    Wow, I spent an entire day trying to recover from this and was just about to call it quits and rebuild the site… thank you!!!

    Reply
  • SamanthaNovember 21, 2013 at 2:37 PM

    Wonderful the error disapears but now I get : An unexpected error has occurred wehen I try to save as template

    Reply
  • LingAugust 18, 2014 at 6:42 AM

    I have error exporting list named “SPUserPoll reponses” at the URL: Lists/SPUserPoll responses while save template

    could you please give me the way to fix it.

    Many thanks.
    Sophia

    Reply
  • ashaFebruary 5, 2015 at 3:09 PM

    Hi,

    I want use this in Production site in SharePoint Online.
    As i got this error while creating design package.
    Dose this solution impacts anything else in site?

    Thanks in advance.

    Asha

    Reply

Leave A Comment

Please enter your name. Please enter an valid email address. Please enter message.