none
How to use Powershell to set Max template document size

    Question

  • I searched for following command

    The default size of site template in Sharepoint 2010 is 50MB. If you want to save site template that have more size you must increase the maximum size by command line using:

    stsadm -o setproperty -pn max-template-document-size -pv 20000000

    but this is for earlier version of SharePoint I want to use the alternate for this command in SharePoint 2010 PowerShell command. How do I do the same?

     


    Shamshad Ali
    Friday, January 21, 2011 10:55 AM

Answers

  • You have to update the MaxTemplateDocumentSize property on the SPWebService ContentService.

    In a SharePoint PowerShell window type"

    $docSize = 50000000
    $webservice = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
    $webservice.MaxTemplateDocumentSize = $docSize
    $webservice.Update()

    You might need to call these if not in a "SharePoint" PowerShell window:
    [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
    [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Administration")

    According to this: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spwebservice.maxtemplatedocumentsize(v=office.12).aspx 500MB is the max.

    Hope this helps!


    SharePoint 2010 MCM. Feel free to contact me http://www.sharepoint.bg/radi
    Friday, January 21, 2011 12:06 PM