2

Using SP 2013.

I have created a site definition in Visual Studio 2012.

Deployed that as a solution.

From the UI I can create a site and select the template I created.

However when I go into PowerShell and call GetAvailableTemplates on the root web, its not there?

For the site I created (from my site def) I go into PowerShell and get SPWeb.WebTemplate which is empty, SPWeb.WebTemplateID contains the ID, which in my case in 10001

If I use SharePoint Manager that does actually show the name of the template. Weird.

If I go into Page Layouts and Site Settings, set to only use my Site Template (which is obviously in the list) ... going back to PowerShell and calling GetAvailableWebTemplates() returns nothing...

I've read that it could be down to caching, but I don't think that affects Powershell ... i did an IIS reset anyway.

2 Answers 2

2

Well, after restarting SQL, IIS nothing seemed to help. So I restarted the box and bingo.
Powershell is finding my template.

Love SharePoint!

2
  • 1
    Wonder if it was caching something (or lack thereof). Glad to hear it is working now for you though. Aug 29, 2013 at 17:22
  • It was caching yes. Although the restart was a temporary solution until i deployed the site def again. I found this and wrote my own little PowerShell cmdlet - which has worked. scle.me/17pKGmc
    – SteveCl
    Aug 30, 2013 at 7:32
0

Have specifically you tried the following:

get-spwebtemplate

That command should return back all of the globally installed site templates.

get-spwebtemplate "STS*"

That command returns specific details for the team site templates. And you can do other filters like that for the other "types" of templates.

4
  • Yep - tried that, should have said. It's not listed in there either
    – SteveCl
    Aug 28, 2013 at 16:14
  • I have just stuck a bit of C# in a page to output the templates ... SPWebTemplateCollection temps = SPContext.Current.Web.GetAvailableWebTemplates(1033); and it is listed. But not in PowerShell?
    – SteveCl
    Aug 28, 2013 at 16:23
  • You don't have some sort of invoke command that is pointing to a different server / environment? Aug 28, 2013 at 17:54
  • nope, certainly not. i've done this a 100 times before in SP2010! honest!
    – SteveCl
    Aug 28, 2013 at 19:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.