Save as List Template of document library which has 18000 documents!
-
04-10-2020 - |
Question
I have one document library which has around 18000 documents(Total size of the all document is around 280 MB).
Now I want to make list template so I go to Library Settings
and then click on Save document library as template
and check Include Content
.
Now after clicking on OK
button, Request goes infinite, the page is never responding.
I have also tried this using PowerShell but it not helped. It throws following exception.
PS C:\Users\SP_Farm> $list.SaveAsTemplate("WFHistoryWithDocs","WFWithDocs","",$t
rue)
Exception calling "SaveAsTemplate" with "4" argument(s): "The list is too
large to save as a template. The size of a template cannot exceed 52428800
bytes."
At line:1 char:1
+ $list.SaveAsTemplate("WFHistoryWithDocs","WFWithDocs","",$true)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : SPException*
So is there any other way to achieve my requirement?
Solution
Issue resolved using PowerShell.
As "User1100" suggested I did need to set maximum list template size using following command
stsadm -o setproperty -propertyname max-template-document-size -propertyvalue 367001600
Or in SharePoint Powershell
$docSize = 367001600
$webservice = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$webservice.MaxTemplateDocumentSize = $docSize
$webservice.Update()
Then also list template was not being saved then I realized that default maximum size for document in document library is 50MB by default (as List Template Gallery is document library). So I updated maximum document size from Central Admin - Manager Web Application - General Setting.
after that $list.SaveAsTemplate("WFHistoryWithDocs","WFWithDocs","",$t
rue)
worked successfully
Thanks
OTHER TIPS
And for those without powershell skills : Delete All items, save as template and then restore the deleted items. Ugly hack but it works