3

I am attempting to save a SharePoint 2013 site as a template from the Site Settings page.

After entering the File Name, Template Name and description (Not Including Content) an error is thrown. Here are some the ULS Log entries. I am looking for options to fix. Thanks for reading.

Getting Error Message for Exception System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> Microsoft.SharePoint.SPException: Invalid file name.  The file name you specified could not be used.  It may be the name of an existing file or directory, or you may not have permission to access the file. ---> System.Runtime.InteropServices.COMException: Invalid file name.  The file name you specified could not be used.  It may be the name of an existing file or directory, or you may not have permission to access the file.    
 at Microsoft.SharePoint.Library.SPRequestInternalClass.GetViewsSchemaXml(String bstrUrl, String bstrListName, Boolean bFullBlown, Boolean bNeedInitAllViews, ISP2DSafeArrayWriter p2DWriter, Int32& plDefaultViewIndex, Int32& plMobileDefaultViewIndex)    
 at Microsoft.SharePoint.Library.SPRequest.GetViewsSchemaXml(String bstrUrl, String bstrListName, Boolean bFullBlown, Boolean bNeedInitAllViews, ISP2DSafeArrayWriter p2DWriter, Int32& plDefaultViewIndex, Int32& plMobileDefaultViewIndex)     -
 -- End of inner exception stack trace ---    
 at Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx)    
 at Microsoft.SharePoint.Library.SPRequest.GetViewsSchemaXml(String bstrUrl, String bstrListName, Boolean bFullBlown, Boolean bNeedInitAllViews, ISP2DSafeArrayWriter p2DWriter, Int32& plDefaultViewIndex, Int32& plMobileDefaultViewIndex)    
 at Microsoft.SharePoint.SPViewCollection.EnsureViewSchema(Boolean fullBlownSchema, Boolean bNeedInitallViews)    
 at Microsoft.SharePoint.SPList.get_Views()    
 at Microsoft.SharePoint.SPSolutionExporter.GetFilesInWeb(String workflowTemplateName)    
 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, Action`1 solutionPostProcessor, Boolean activateSolution)    
 at Microsoft.SharePoint.ApplicationPages.SaveAsTemplatePage.BtnSaveAsTemplate_Click(Object sender, EventArgs e)    
 at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)    
 at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)    
 at System.Web.UI.Page.HandleError(Exception e)    
 at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)    
 at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)    
 at System.Web.UI.Page.ProcessRequest()    
 at System.Web.UI.Page.ProcessRequest(HttpContext context)    
 at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()    
 at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

--

System.Runtime.InteropServices.COMException: Invalid file name.  The file name you specified could not be used.  It may be the name of an existing file or directory, or you may not have permission to access the file.   
 at Microsoft.SharePoint.Library.SPRequestInternalClass.GetViewsSchemaXml(String bstrUrl, String bstrListName, Boolean bFullBlown, Boolean bNeedInitAllViews, ISP2DSafeArrayWriter p2DWriter, Int32& plDefaultViewIndex, Int32& plMobileDefaultViewIndex)    
 at Microsoft.SharePoint.Library.SPRequest.GetViewsSchemaXml(String bstrUrl, String bstrListName, Boolean bFullBlown, Boolean bNeedInitAllViews, ISP2DSafeArrayWriter p2DWriter, Int32& plDefaultViewIndex, Int32& plMobileDefaultViewIndex)

--

System.Runtime.InteropServices.COMException: Invalid file name.  The file name you specified could not be used.  It may be the name of an existing file or directory, or you may not have permission to access the file., StackTrace:   
 at Microsoft.SharePoint.SPViewCollection.EnsureViewSchema(Boolean fullBlownSchema, Boolean bNeedInitallViews)    
 at Microsoft.SharePoint.SPList.get_Views()    
 at Microsoft.SharePoint.SPSolutionExporter.GetFilesInWeb(String workflowTemplateName)    
 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, Action`1 solutionPostProcessor, Boolean activateSolution)    
 at Microsoft.SharePoint.ApplicationPages.SaveAsTemplatePage.BtnSaveAsTemplate_Click(Object sender, EventArgs e)    
 at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)    
 at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)    
 at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)    
 at System.Web.UI.Page.ProcessRequest()    
 at System.Web.UI.Page.ProcessRequest(HttpContext context)    
 at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()    
 at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)    
 at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)    
 at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)    
 at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)    
 at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)    
 at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)    
 at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)    
 at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)    
 at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)    
 at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
  • Do you have permission to the template gallery and what were you trying to name it? Invalid file name. "The file name you specified could not be used. It may be the name of an existing file or directory, or you may not have permission to access the file. ---> System.Runtime.InteropServices.COMException: Invalid file name. The file name you specified could not be used. It may be the name of an existing file or directory, or you may not have permission to access the file." – Eric Alexander Aug 16 '13 at 0:40
  • Can you Check the creating with antobet user? – Sascha Apr 6 '14 at 6:37
2

use powershell to achive this:

$Web=Get-SPWeb http://Server/Site
$Web.SaveAsTemplate("Template Name","Template Title","Template Description",1)

http://spcodes.blogspot.co.uk/2012/12/save-site-as-template-powershell-command.html

solutions gallery is where you will find the new template :)

http://www.sharepoint-journey.com/backup-and-restore-sharepoint-2013-part2.html

as PirateEric noted its says in the error you posted:

System.Runtime.InteropServices.COMException: Invalid file name. The file name you specified could not be used. It may be the name of an existing file or directory, or you may not have permission to access the file.

that indicated either:

1) you are trying to save the template in the same name! so try a different one

2) you dont have sufficient permission to save the template!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.