SPSolutionExporter: Microsoft.SharePoint.SPException: Error exporting the list named…

So I encountered this error when attempting to save a Site as a template.  In the ULS logs the following was recorded:

SPSolutionExporter: System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.SharePoint.SPSolutionExporter.ExportListViews(SPList list, XmlWriter schemaWriter, ListExportSummaryInfo summaryInfo)
at Microsoft.SharePoint.SPSolutionExporter.ExportList(SPList list)
at Microsoft.SharePoint.SPSolutionExporter.ExportLists()

and this:

SPSolutionExporter: Microsoft.SharePoint.SPException: Error exporting the list named “Services”
at the URL: Lists/Services
at Microsoft.SharePoint.SPSolutionExporter.ExportLists()
at Microsoft.SharePoint.SPSolutionExporter.GenerateSolutionFiles()
at Microsoft.SharePoint.SPSolutionExporter.ExportWebAsSolution()

and this:

Microsoft.SharePoint.SPException: Error exporting the list named “Services”
at the URL: Lists/Services
at Microsoft.SharePoint.SPSolutionExporter.ExportLists()
at Microsoft.SharePoint.SPSolutionExporter.GenerateSolutionFiles()
at Microsoft.SharePoint.SPSolutionExporter.ExportWebAsSolution()
at Microsoft.SharePoint.SPSolutionExporter.ExportWebToGallery(SPWeb web, String solutionFileName, String title, String description, ExportMode exportMode, Boolean includeContent, String workflowTemplateName, String destinationListUrl)
at Microsoft.SharePoint.SPSolutionExporter.ExportWebToGallery(SPWeb web, String solutionFileName, String title, String description, ExportMode exportMode, Boolean includeContent)
at Microsoft.SharePoint.ApplicationPages.SaveAsTemplatePage.BtnSaveAsTemplate_Click(Object sender, EventArgs e)
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Or this:

System.Runtime.InteropServices.COMException: List does not exist.  The page you selected contains a list that does not exist.  It may have been deleted by another user. [Managed code transition]
at Microsoft.SharePoint.Library.SPRequestInternalClass.GetListsWithCallback(String bstrUrl, Guid foreignWebId, String bstrListInternalName, Int32 dwBaseType, Int32 dwBaseTypeAlt, Int32 dwServerTemplate, UInt32 dwGetListFlags, UInt32 dwListFilterFlags, Boolean bPrefetchMetaData, Boolean bSecurityTrimmed, Boolean bGetSecurityData, Boolean bPrefetchRelatedFields, ISP2DSafeArrayWriter p2DWriter, Int32& plRecycleBinCount)
at Microsoft.SharePoint.Library.SPRequest.GetListsWithCallback(String bstrUrl, Guid foreignWebId, String bstrListInternalName, Int32 dwBaseType, Int32 dwBaseTypeAlt, Int32 dwServerTemplate, UInt32 dwGetListFlags, UInt32 dwListFilterFlags, Boolean bPrefetchMetaData, Boolean bSecurityTrimmed, Boolean bGetSecurityData, Boolean bPrefetchRelatedFields, ISP2DSafeArrayWriter p2DWriter, Int32& plRecycleBinCount)

Every time SharePoint would complain about not being able to Save the Site as a template.  Typically I would suspect some kind of list corruption here, but this was not the case.  The list was accessible in all cases, via a browser, SharePoint Designer and SharePoint Manager.

The Solution:

I have often found that list corruption can be fixed simply by deleting the list in question so that it is sent to the Recycle Bin, and then immediately restoring it.  Once again this proved to be the solution to this problem.

Why this is the case I am not entirely sure but I now see the Recycle bin in a whole other light, and now also refer to it as the “SharePoint 2010 List corruption removal feature”

Hope this helps someone else

 
Comments

No comments yet.