Get Available App Templates in SharePoint 2013 (Preview)

I’m starting to dig deeper into SharePoint 2013 Preview, and one of the first things I wanted to do was poke around the Object Model using PowerShell. In doing so, I thought it would be nice to have a quick and easy PowerShell Function to grab all available app templates.

This is actually very simple and is basically identical to the code which would work in SP2010, we simply grab an SPWeb object and then grab the ListTemplates collection.

Here are two examples of how to run it…

This example gets ALL app templates in a web at URL http://sp2013:

Get-SPAppTemplate -WebUrl http://sp2013

This example gets the Asset Library template in a web at URL http://sp2013:

Get-SPAppTemplate -WebUrl http://sp2013 | Where-Object {$ -eq "Asset Library"}

Here is the function, which can be run in SP2013 to return all available app/list templates:

function Get-SPAppTemplate {
	This advanced PowerShell Function retrieves available app/list templates
	in a specified SharePoint Web.
	This advanced function retrieves an SPWeb object and retrieves all 
	ListTemplates in the collection. Optionally, you can use *-Object cmdlets
	to retrieve a specific template or to select specific fields.
	C:\PS>Get-SPAppTemplate -WebUrl http://<webUrl> | Where-Object {$ -eq "Asset Library"}
	This example searches for an App tepmlate with the name "Asset Library."
	C:\PS>Get-SPAppTemplate -WebUrl http://<webUrl>
	This example retrieves all app templates under the webUrl SPWeb.
	Name: Get-SPAppTemplate
	Author: Ryan Dennis
	Last Edit: 9/11/2012
	Keywords: Get-SPWeb,Get-SPAppTemplate
#Requires -Version 3.0
$Web = Get-SPWeb $WebUrl