SharePoint 2007 to 2010 site upgrade: problems and solutions

Recently, our project was in the process of migrating an existing SharePoint 2007 sub-site with the publishing features enabled, to a separate site collection and convert it to SharePoint 2010 as well.

The plan was to use stsadm to create an export of the sub-site, which in turn could be imported again on an acceptance environment in a newly created web application with separate content database. I’d make the necessary adjustments to get the site to work as a site collection and then the content database was to be copied to the SharePoint 2010 development environment. We chose this course of action, as the site was part of a much larger site collection, which didn’t need to be migrated to SharePoint 2010 as of this moment.

Now, I already did my fair share of reading up on the topic and it turns out, converting a sub-site into a site collection when the publishing features are enabled, isn’t exactly supported. To add on top of that the migration to SharePoint 2010, things were looking rather grim.

First of all, getting the export to be imported correctly on the acceptance environment took a few attempts (version numbers of SharePoint solutions didn’t match, Terminal Services sessions being terminated in the middle of an import (yes, that actually happened), imports that were successful according to the tool, but when the site content was checked, most of the lists and libraries didn’t actually contain any content). But after a while we had that up and running, so I could replace the missing page layouts and master pages, make the necessary changes to the web.config file, so the site was ready for migration to SharePoint 2010.

The migration process involved copying the content database to SharePoint 2010, attaching it to a newly created web application running the upgrade. Funnily enough, that actually ran without any significant issues. It was when I actually start working on the site, a whole array of bizarre errors was encountered. This blog post’s purpose is to outline these errors and provide the solutions I’ve found during the two days I’ve been banging my head against the desk trying to figure it out:

Invalid SPListItem. The SPListItem provided is not compatible with a Publishing Page.

I seemed to be getting this error after creating a new page and then saving and closing the page; it would then throw this error.

Solution: Deactivate the site “SharePoint Server Publishing” feature and activate it again.

One or more field types are not installed properly. Go to the list settings page to delete these fields.

This error would occur when I opened the “Site Content and Structure” page and also after attempting to deactive the “SharePoint Server Publishing” feature on the site (related to the error above).

Apparently this is caused by a missing field in the hidden Relationships List on the site. This list is created by Publishing Resources and is used to store variations relationships. Note that the error I mentioned didn’t actually have to do with variations, as I’m not even using that on the site.

The upgrade process should have (at least I assume so), created an additional column called GroupGuid in this list, but in my case it hadn’t done so. Unfortunately its field type is supposed to be Guid and this type cannot be selected from the user interface when creating a new column.

Solution:
Use this tool to export the list on a working site and import it again on the site having issues:

http://spdeploymentwizard.codeplex.com

Be sure to add the following entry to the application config, as the Relationships List is hidden by default.

<appSettings>
<add key="ListsNotForExport" value="Cache Profiles" />
</appSettings>

The “Cache Profiles” value is in there because the application seemed to ignore a blank value; it would then still hide the Relationships List:

Also, uncomment the section that mentions using the tool with SharePoint 2010.

Start the tool, and follow these steps:

  1. Select “Export” and enter the URL of the working site on the first page of the wizard and click Next;
  2. Locate “Relationships List” in the tree and right-click the item; select Export -> Include all descendants and click Next;
  3. On the ‘Export Settings’ page, I only filled out the ‘Export folder’ and base filename fields. Use settings appropriate to your situation and click Next;
  4. On the next page, click the ‘Finish’ button to start the export;
  5. Once completed, start the tool again but then with “Import” as action. Enter the URL of the non-working site and click Next;
  6. Select the import file created earlier, leave the other settings to their default values and click Next;
  7. On the next screen, click ‘Finish’ to start the import process.
  8. Go to the site that has problems and access the following URL:
    http://<site URL>/Relationships%20List/AllItems.aspx
  9. Delete the old item that was in the list. This should be the item that doesn’t have a value for the GroupGuid field;
  10. All done, the issue should now be resolved.

Error_pagetitle

An error occurred while getting the items.

List does not exist.

The page you selected contains a list that does not exist. It may have been deleted by another user.

I was getting this error when I opened the “Create list” dialog (the one with the Silverlight control on it). I was actually getting a similar error when deploying a solution from Visual Studio:

Error occurred in deployment step ‘Recycle IIS Application Pool’: The list does not exist.

Solution:
  1. Open up the SharePoint 2010 Management Shell
  2. Run the following cmdlet:
    get-spcontentdatabase
  3. Copy the ID of the database that you’re having problems with
  4. Then run this cmdlet:
    upgrade-spcontentdatabase -id <ID>
  5. That should resolve the issue.

Fixing the publishing page layout URLs when restoring from a subsite to a site collection

Since the site we migrated, originally was a sub-site of a larger site collection, the page layout URLs of existing pages needed to be updated to their respective new locations. After the migration, everything was still pointing to the old site collection’s master page gallery.

Solution:

Create a new console application (remember to set the target framework to .NET 3.5 and the platform target to ‘Any CPU’) and copy in the following code:

static void Main(string[] args)
{
    try
    {
        using (SPSite site = new SPSite(""))
        {
            using (var web = site.OpenWeb())
            {
                FixPageLayoutsUrl(web);
            }
        }
    }
}
 
private static void FixPageLayoutsUrl(SPWeb web)
{
    var spPubWeb = PublishingWeb.GetPublishingWeb(web);
    var pages = spPubWeb.PagesList;
 
    foreach (SPListItem item in pages.Items)
    {
        var pubPage = PublishingPage.GetPublishingPage(item);
 
        if (null == pubPage || null == pubPage.ListItem)
        {
            continue;
        }
 
        var url = new SPFieldUrlValue(Convert.ToString(pubPage.ListItem[FieldId.PageLayout]));
        const string urlPart = "/relative/url/tositecollection";
 
        if (url != null &amp;&amp; !String.IsNullOrEmpty(url.Url) &amp;&amp; url.Url.Contains(urlPart))
        {
            url.Url = url.Url.Replace(urlPart, "");
 
            Console.WriteLine(pubPage.Name);
            pubPage.CheckOut();
            pubPage.ListItem[FieldId.PageLayout] = url;
            pubPage.ListItem.UpdateOverwriteVersion();
 
            pubPage.ListItem.File.CheckIn("Fixed page layout URL.", SPCheckinType.MajorCheckIn);
        }
    }
}

Enter the URL of the site collection on which you’re having problems. Also, replace the urlPart part with a value appropriate to your situation. You may need to rewrite a part of the code there to make it work for your environment. The general idea is to replace the list item’s PageLayout column with the new URL.

Could not create a new page; the process in the dialog would hang and eventually result in a timeout

The same thing would happen when accessing “Page layouts and site templates” from the Site Settings page.

The problem may have been related to the fact that this was a migration from a sub-site to a site collection. The initial ite collection had its available page layouts restricted and this setting may have been included in the export, causing the problem.

Solution:

Run the following piece of code from a commandline utility and do an iisreset after:

static void Main(string[] args)
{
    try
    {
        using (SPSite site = new SPSite(""))
        {
            using (var web = site.OpenWeb())
            {
                var publishingWeb = PublishingWeb.GetPublishingWeb(web);
                publishingWeb.AllowAllPageLayouts(true);
                publishingWeb.Update();
            }
        }
    }
}

Replace the site collection URL with a value appropriate to your environment.

Critical entry in the event log when attempting to open the ‘Create list’ page in SharePoint

Insufficient SQL database permissions for user ‘Name: <UserID> SID: <SID> ImpersonationLevel: Impersonation’ in database ‘<database>’ on SQL Server instance ‘<instance>’. Additional error information from SQL Server is included below.

The EXECUTE permission was denied on the object ‘proc_GetProductVersions’, database ‘<database>’, schema ‘dbo’.

Solution:

  1. Open SQL Server Management Studio and connect to the proper server instance
  2. In the database server, expand the database on which you’re having problems and navigate to Programmability – Stored Procedures – dbo.proc_GetProductVersions.
  3. Open the stored procedure’s properties.
  4. On the new screen, select ‘Permissions’ on the left and click the Search button.
  5. On the new screen, click Search, select the [WSS_Content_Application_Pools] role and click OK.
  6. Click OK again.
  7. On the first popup screen, select the role, check ‘Execute’ permission and click OK.
Thinking about it, perhaps most of the problems might have been fixed after running the Powershell content database upgrade again, but I didn’t get a chance to test that separately.
I’ll try to update this post should I encounter any more issues. Hopefully this helps anyone who’s struggling with migrating a SharePoint 2007 to 2010.
Be Sociable, Share!

One thought on “SharePoint 2007 to 2010 site upgrade: problems and solutions

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">