Wednesday 6 November 2013

Upload STP File to the List Template Gallery in SharePoint using PowerShell

Share it Please
  1.Click "Start" button
    2.Choose the "Microsoft SharePoint 2010 Products"
    3.Click the "SharePoint 2010 Management Shell" [ run as Administrator ]

Syntax:-

   $web = Get-SPWeb "SiteCollectionURL"

   $spFolder = $web.GetFolder("List Template Gallery")
   $spFileCollection = $spFolder.Files
   $file = Get-ChildItem "StpfilePath"
   $spFileCollection.Add("_catalogs/lt/StpFileName", $file.OpenRead(), $true)
Example:-
   
  $web = Get-SPWeb "http://Abcd/sites/SamSite"
  $spFolder = $web.GetFolder("List Template Gallery")
  $spFileCollection = $spFolder.Files
  $file = Get-ChildItem "C:\Users\Administrator\Desktop\Mohamed sithik\Employee.stp"
  $spFileCollection.Add("_catalogs/lt/Employee.stp", $file.OpenRead(), $true)

No comments:

Post a Comment

Followers

Follow The Author