Get-SPListTemplates

This Advanced PowerShell Function uses the ListTemplates Property of an SPWeb Object to retrieve available SharePoint 2010 List and Library Templates.

 
 
 
 
 
2.7 Star
(3)
Add to favorites
SharePoint
7/8/2011
E-mail Twitter del.icio.us Digg Facebook
  • Comment
    1 Posts | Last post September 20, 2011
    • Ryan, apparently line breaks are not respected by the Q/A functionality - this makes my proposed code difficult to read. Copy and paste out what I posted into Notepad or something to take a look. A thread on the forum that I posted, http://social.technet.microsoft.com/Forums/en-US/sharepoint2010programming/thread/0de09223-ee79-49c9-8081-cf0512d8b14f/#68c7be6a-2005-4545-bcb5-64ae8f01274c, contains similar SPAssignment code if you wish to look at it formatted correctly.
  • Function Comment - Potential Improvement
    1 Posts | Last post September 20, 2011
    • Ryan,
      
      Thanks for sharing this function. I'd like to propose one improvement so the -Global SPAssignment isn't used which could cause issues if your function is used in conjunction with other scripts/functions that use the -Global SPAssignment:
      
      -----
      $webSPAssignment = Start-SPAssignment 
      $SPWeb = $webSPAssignment | Get-SPWeb -Identity $Web 
      ...
      #$SPWeb.Dispose() <---Comment out this line or remove it
      $webSPAssignment | Stop-SPAssignment 
      -----
      
      This way, only the targeted SPWeb used by the function will be disposed and this will not impact the -Global SPAssignment if there is anything else that is targeted by -Global.
      
      Kind regards,
      
      Craig