Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

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

Love SharePoint!

share|improve this answer
1  
Wonder if it was caching something (or lack thereof). Glad to hear it is working now for you though. –  MAllen22842 Aug 29 '13 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 '13 at 7:32

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.

share|improve this answer
    
Yep - tried that, should have said. It's not listed in there either –  SteveCl Aug 28 '13 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 '13 at 16:23
    
You don't have some sort of invoke command that is pointing to a different server / environment? –  MAllen22842 Aug 28 '13 at 17:54
    
nope, certainly not. i've done this a 100 times before in SP2010! honest! –  SteveCl Aug 28 '13 at 19:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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