SharePoint Error after migrating to SP 2010 from MOSS 2007 Item is no longer available

We migrated our SharePoint 2007 WCM Publishing site collection to SP 2010 and we used DB attach in this process. Most of the list made it to SP 2010 gracefully but some of the lists created some issues for us and we started getting this error on the ECB menu "The item is no longer available. It may have been deleted by another user.". Did some BING.com but the only suggestions we got were that open SharePoint designer and open the default view (AllItems.aspx) and select the Listview webpart on that page and delete that add the Dataview webpart from the Insert Menu in the ribbon, save the Page and try to browse.

When we browse to that List again to my surpirse the default View disappears and is not even visible in the list of default views (List settings). But when I open the list in SharePoint Designer I can see the list for (AllItems.aspx) there. So after some rumbling with powershell and List Object model I found that whenever we save the default view by changing the Listview to XSLT Listview webpart (to get the checkbox and ECB to work) the AllItems.aspx form is marked hidden. So to solve this issue I used a very simply powershell and got this one to work (now the List view shows up in the List settings as default view and also it is visible)

I don’t know why but as soon as
we modify the view using SPD it just marks the view as hidden, I used following
powershell to fix it and get the view back:

 

$sitecoll = get-SpSite (https://mysitecollectioname.company.com);

//Make sure the List name is correct

$list =$sitecoll.RootWeb.Lists["MyListName"]       
 

// Make sure the View Name is correct some lists might have a different
view name and sometimes the view name is “All Items” with a space
not “AllItems

$view2 = $list.Views["AllItems"]                          
               

$view2.DefaultView =
$True       

$view2.Hidden = $False

$view2.Update()

 

Hope this helps someone in future in case if you dont see the checkboxes or you dont see the ECB menu working and giving you javascript error.