Wednesday 6 November 2013

save list as custom template using PowerShell

Share it Please
Powershell Script:-

              $site = get-spsite("http://abcd:12312/sites/Sample/")
              $web = $site.RootWeb
              $list = $web.Lists["MyCustomListName"]
              $list.SaveAsTemplate("MyCustomListTemplate.stp",                                                                                   "MyCustomListTemplate","MyCustomList Template", $false)
              $listTemplates = $site.GetCustomListTemplates($web)
              $web.Lists.Add("MyCustomNewList", "My CustomNew List",                                                                               $listTemplates["MyCustomListTemplate"])

Note:-
             http://abcd:12312/sites/Sample/=site collection url
             MyCustomListName =CustomList Name
             MyCustomListTemplate.stp =stp file Name

No comments:

Post a Comment

Followers

Follow The Author