Error on theme page post SharePoint 2010 upgrade

I recently upgraded a MOSS 2007 site to SharePoint Server 2010 which seemed to go relatively smoothly, however a short while after the upgrade a user reported they got an error when trying to set the theme on a new site.

When I checked this was indeed the case i got an object reference not set to an instance of an object error, see full error below. I spent some time looking into this and researching information online and I was able to establish the error was down to the fact that the theme gallery had not been created in the upgraded site.

I found some articles, see below, that seemed to deal with the same issue and while I found the information useful it didn’t supply instructions on how this could be achieved hence why I decided to document the steps I performed to correct this.

http://social.technet.microsoft.com/Forums/en-IN/sharepoint2010setup/thread/62ad2624-26f1-4193-8917-fa37ae18ca08

http://www.sharepointalex.co.uk/index.php/2010/09/themes-gallery-missing-in-sharepoint-2010-site-after-visual-upgrade/

From looking at the articles above the options were to re-create the theme gallery or redo the upgrade. Realistically redoing the upgrade was not an option so this left me with trying to either move the theme gallery from another site collection or recreating it.

My first though was this was something I could do through SharePoint Designer so I opened a test SharePoint 2010 site and tried to export the themes list but quickly found this was not possible.

My next attempt was to try and copy from one SharePoint Designer instance to another. To do this I created a test site collection on the production environment and opened this in SharePoint Designer. With two SharePoint Designer windows open side by side I tried to copy the theme gallery from the test site and paste it into the upgraded site. This partially worked but it re-created it as a folder not a list so while I could browse to the URL it didn’t recognise it as a list.

Next I tried copying the theme gallery as a list template and re-create it using this. I navigated to the theme gallery on my test site collection and went to the settings but found there is no save list as a template option on this list. I got around this by getting the list ID of the theme gallery and then going to save another list and clicking save as a template. In the new screen I then replaced the list ID in the query string with the theme gallery list ID. This then allowed me to save the gallery as a template and I could see it in the list gallery. When I then went to create a new list I found the template I saved was not available. Thinking about it this made perfect sense as the default theme gallery list definition is mark as hidden so any new templates created using this type of list would also be hidden.

The solution that finally work was to create a new list through the UI but change the URL to supply the out of the box theme gallery list template ID. From research online I was able to identify that the theme gallery template ID was 123 so I went to the root of my site and created a list as normal but I then changed the URL removing the feature ID and changed the ListTemplate querystring parameter to 123. I entered the list name as theme and clicked ok. This created my list as expected but it was still in the wrong location. In order for the theme functionality to work the list had to be under the catalogs folder. To move the list I opened SharePoint Designer and simply dragged the list to where it should be. At this point I could now use the set theme functionality but there were no items so once again I opened my test site collection in SharePoint Designer and copied all the themes across to my upgrade site. When I then refreshed the choose theme page it worked and all the themes were available to choose from.

Conclusion

Being a developer normally I don’t use SharePoint Designer, however in this case I found it extremely useful to be able to move and manipulate objects in the SharePoint site.

Hopefully other people will find this useful, however please ensure if there is anything you are not sure of try it on a development environment first and always ensure you have a back up you can revert to before stating any work.

Full Error Details

Exception information:
    Exception type: NullReferenceException
    Exception message: Object reference not set to an instance of an object.
Thread information:
    Thread ID: 9
    Thread account name: DomainOurAccount
    Is impersonating: False
    Stack trace:    at Microsoft.SharePoint.ApplicationPages.ThemeWebForm.<>c__DisplayClass2.<LoadV4Page>b__0()
   at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass4.<RunWithElevatedPrivileges>b__2()
   at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)
   at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param)
   at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode)
   at Microsoft.SharePoint.ApplicationPages.ThemeWebForm.LoadV4Page()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Advertisements

6 Responses to Error on theme page post SharePoint 2010 upgrade

  1. JC says:

    I just want to say your are my new hero, i been searching and trying so many workarounds from others sites without any luck. I did an upgrade from wss 3.0 to 2010 and i had exactly the same problems as you did.

    I was getting sick off people nagging me about the themes, save site as templates and the silverlight not working.

    Many Thanks!!!

  2. Andrew Wolfe says:

    This can also fix a missing Solutions gallery that stops you saving a site as a template or causes the Silverlight control to churn forever (or through a stupid error).

    Solution gallery is list type 121 (http://joelblogs.co.uk/2011/06/16/sharepoint-2010-base-types-list-template-and-definition-ids-and-content-types-ids/) and lands in the _catalogs by itself

  3. logan says:

    You helped me resolve my theme issue!!! I didn’t have to use a special list ID or anything, just move it to the _catalogs folder and put all the .thmx files in there. THanks a bunch 🙂

  4. Kate says:

    Thank you thank you THANK YOU!!! I, too, didn’t need the list ID. I was able to get the contents of the theme folder by creating a junk site collection on a junk port on my test 2010 server.

  5. Thiru says:

    Hi,

    I am also facing same issue. Migrated from 2007 to 2010 and Themes and Solutions are not visible under Galleries.
    I am in root site collection.
    Kindly help me.

    • raymondlittle1000 says:

      Hi Thiru,

      Have you tried creating the list manually through the browser as suggested in the article above?

      Cheers,

      Ray

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: