Thursday, June 5, 2014

Manage Content and Structure giving error in Sharepoint 2010

I'm posting old issue here, which i resolved it a year back, but still might be helpful.

An unexpected error has occurred when attempting to use the Manage Content and Structure after migrating SharePoint 2007 to SharePoint 2010 , under Site Actions > Manage Content and Structure, I received the below error. Looking into the ULS logs, all I was able to get ahold of was a System.NullReferenceException. Again, not really handy, or useful, at all.

List does not exist. The page you selected contains a list that does not exist.  It may have been deleted by another user
Solution: 
1. First, We have to get rid of the duplicated tasks column from the corrupted list ,before taking a database backup.This will ensure that you can successfully get to the content type and field update section of the upgrade process
 2. Take a SQL backup of the content DB and restore it as new database name in SQL server without attaching it to a sharepoint site yet 
3. Execute the cleanup in SQL
a. Run following the query in SQL management studio against the restored data, this will generate a list of sql queries you will need to copy from the result and execute in a new window. This is required to always get the correct delete top X queries based on the current  data. 

select 'delete TOP('+CAST((rescnt-1) as nvarchar(50))+') from contenttypes where siteid='' enter your site id'' and scope='''+scope+'''  and contenttypeid=',ContentTypeId from (select COUNT(*) as rescnt,contenttypeid,scope from contenttypes where siteid=" Enter your site id'' group by contenttypeid,scope having count(*)>1 ) as table1

b. Execute the generated delete top queries to remove duplicated fields and content types

c.  Execute the following two queries to get rid of the out of the box content types created at subsite level which block the upgrade.

delete from ContentTypes where class=0 and CAST(ContentTypeId as uniqueidentifier)  in (
Add content type ids here ')      
and scope!=''
and SiteId='Enter your site id'


delete  from ContentTypes
where class=1 and ContentTypeId in (
Enter all Content type IDs here from the above select query) and scope!='' and SiteId='Enter your site id'


d.  Attach the corrected database to your sharepoint site with mount-spdatabase and save the upgrade logs.

e.  Run this powershell
$db = get-spdatabase
$db | Upgrade-SPContentDatabase

Where the guid is the id of the database ( you can find it in the databaseinfo table or in the output of get-spdatabase | ft -a)

f. If the upgrade completes without errors run the following in powershell
$s = get-spsite ;
$SiteURL = $s.Url;
Enable-SPFeature fields -Url $SiteURL -Force;
Enable-SPFeature ctypes -Url $SiteURL -Force;

g. Test the Manage content and structure page.

(OR)
       
Some cases , delete the list using either stsadm or powershell commands will also work.
stsadm.exe -o forcedeletelist -url <your list url; eg. http://site/listname>

Once the command succeeds, i.e. removes the corrupted list, Content and structure will be available again for use.

No comments: