2

I want to save a library as a template.

For this I use the following PowerShell code

    $id = [Guid]::NewGuid()     
    $templateName = [String]::Format("{0}-{1}",$list.Title,$id.ToString());
    $templateFileName = $templateName;       
    $destinationListDescription = $list.Description;  
    $list.SaveAsTemplate($templateFileName, $templateName, $list.Description, $false)
    $listTemplate =  $site.GetCustomListTemplates($SPWeb)[$templateName]
    $SPWeb.Lists.Add($Destination, $Destination, $listTemplate) | out-null;   
    $SPWeb.Update()

In our development, test and acception enviroments everything went well but in our production environment the process of saving the template takes more than an hour. The only difference is that the library in production contains many many documents

Also when I try to save the list from the browser this also takes ages.

Does anyone now why saving the list as template takes so long and is there an other, fast way to save the list as a template?

  • It's not directly stated or commented on. Is saving the list data a requirement? Or are you even saving the data with the list? – beavel Jan 14 '14 at 12:37
  • No the data is not saved. Only the design. If the data was saved then it was not strange why it takes so long. – Remko Jan 14 '14 at 12:44
  • I was assuming that might be the case, but the data not being saved wasn't explicitly stated. You may want to add Patch level to this question in case it is version specific or some type of regression. – beavel Jan 14 '14 at 16:53

Your Answer

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

Browse other questions tagged or ask your own question.