After creating a site template with contents, SharePoint tells me that everything went OK, and prompts me to go to the Solution Gallery. However, it is empty. Try as I might, I cannot create a site template through the user interface. The Publishing features are disabled and the "Save site as template" option does appear in the site settings. If I use PowerShell, I get the following message:

Exception calling "SaveAsTemplate" with "4" argument(s): "Error generating solution files in temporary directory."

  • How did you create the Site Template? Can you post your code for that?
    – Pradip R.
    May 5, 2015 at 10:35
  • Like I said, I tried to create the site template either through the user interface, PowerShell and lately through .NET code (SPSolutionExporter.ExportWebToGallery). May 5, 2015 at 10:42
  • I think the operation you are performing does need full control over the disk because as the error suggest that it does need rights to access the temporary directory. You should try with different user or else you can use SPSecurity.RunWithElevatedPrivileges method. Refer this MSDN article: msdn.microsoft.com/en-us/library/…
    – Pradip R.
    May 5, 2015 at 10:51
  • Thanks, but I am running as a local administrator, farm administrator and the SharePoint farm is even running under the same account. If the temporary location is c:\windows\temp, then it is world-writable anyway. May 5, 2015 at 10:53
  • Look at the following article: sharepointblogs.be/blogs/vandest/archive/2014/05/23/… Is it helpful?
    – Pradip R.
    May 5, 2015 at 10:56

1 Answer 1


Problem solved: I had to give full permissions to c:\windows\temp. Even though I am an administrator, and so is the SharePoint farm account. Microsoft only knows why.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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