I got this morning from about STSADM. She wanted to know if a site template had to be added with 'stsadm –o addtemplate' before you could use it with 'stsadm –o createweb.' I have to admit, I didn't know the answer off the top of my head. I could convince myself either way. I ended up having to test it before I came to a conclusion. Before I get to whether it works or not, some background on why it's even a question If you've been to any of my SharePoint admin sessions or classes you're familiar with me preaching that Site Collections are the administrative and security boundary in SharePoint. This means that a user given permissions to one Site Collection cannot automatically get into another Site Collection without being given permission to it as well. Site Collections also are boundaries for resources kept in Site Collection galleries, like web parts, content types and site templates. Because of this boundary it's possible for administrators in one Site Collection to create resources that are only visible in their Site Collection. ![]() How does one do that? First, we have to be clear about the terminology we're using, because it gets confusing here. First we have the. That's the boundary, the bag. ![]() Then we have the things that go into Site Collections. Here's where it gets confusing. Sometimes the SharePoint interface calls those things Sites, and other times it calls those things. They're the same thing. This blog will be particularly confusing because it's one instance where the name changes frequently. STSADM commands for Sharepoint 2007 sp2. Uploadformtemplate stsadm -o uploadformtemplate -filename template file> userrole stsadm.exe -o. Code Samples; Resources. STSADM -o setproperty -pn max-template-document-size. You can use a site template to create a site within an existing site collection. Assume if something is not called out as a Site Collection, it's a web. Back to the question, how does a Site Collection administrator add new Site (really web) templates to their Site Collection? They take an existing Site (still really a web) and mock it up the way they want it. Maybe they add some pages, drop some web parts on some pages, maybe even upload a document or two. Once they get it juuuuust right, they save that Site (did I mention these are webs?) as a Site (web) Template. When they do that it's added to the Site Collection's Site (web) Template gallery. From that point on, anyone in the Site Collection that has permissions to create a Site (web) in that Site Collection can use that new Site (web) template to do so. The beauty of this is that no one outside of that Site Collection can see that Site (web) template. If you go to Site Actions > Site Settings > Galleries > Site Template Gallery you can see the Site (web) templates that have been created. That's all fine and dandy, but what if that Site (web) Template is so awesome that someone else wants to use it? SharePoint's got your back, and provides a way to share Site (web) templates. If you have a Site (web) Template in your Site (web) Template Gallery, hover over it. You'll see it's a hyperlink. If you click it, your browser will try to download an STP file. That STP file is a Site (still typing web here) TemPlate file. You can give that STP file to an administrator for another Site Collection. If they upload it to their Site (you guessed it, web) Template Gallery now they can use it too. Pretty nifty, eh? So far this setup is working pretty well. But what happens if you have hundreds, nay, thousands of Site Collections? This approach doesn't scale very well at all. Once again, the fine folks at Microsoft were thinking ahead and they provided a way for you to take that STP file and make it available to the entire Farm in one step. How do you accomplish such a Herculean task? I'm glad you ask. First you download that STP file. Then you give it to one of your Farm Administrators. They log into one of the SharePoint boxes and use the STSADM operation 'addtemplate' to add your template to the farm. Now everyone will see it when they create a Site (stick with me here, web) in the interface. The bottom line is that SharePoint allows you to keep Site (web) Templates private to a Site Collection or make them available to the entire Farm, whichever suites your needs best. Back to Laura's question. She wanted to know if she could specify a custom Site (thanks for sticking with me, web) Template if she was creating the web not through the UI, but with 'stsadm –o createweb' (see, they call it 'web' here. I told you!). I know that when the Site (do I need to keep typing 'web' here) Template is created it's added to the Site Collection, so it's in the Content DB. In theory STSADM could look for the Site (yup, web) Templates the target Site Collection had when creating the web. On the other hand I knew that the 'addtemplate' operation put them someplace else, and maybe that's the only place STSADM looked when executing 'createweb.' To solve this I tested it myself. I created a custom Site (almost finished here, web) Template and then tried to use it when creating another web in that Site Collection with 'stsadm –o createweb.' It said that was an invalid template named. Executing 'stsadm –o enumtemplates' showed me what template names were valid. Of course mine was not in that list. Once I added my Site (last time, I promise, web) Template to the farm with 'stsadm –o addtemplate' I could use it with the 'createweb' operation. I hope that all made sense. The fact that Microsoft chose to refer to these objects as 'sites' in the UI most places and 'webs' in other places makes this very difficult to explain. I hope it all made sense. Todd, Laura and I continued part of this discussion via Twitter after your post. It is possible to use a custom site (web) template with the 'stsadm -o createweb' command without first performing the 'stsadm -o addtemplate'. It may not be enterprise-worthy, but is possible. First add the template to the site collection gallery by uploading the.stp file as you mentioned above. Then run 'stsadm -o createweb' command without specifying a site template. Now navigate to the newly create site (web) and you'll be presented with a selection choice for which site (web) template you'd like to apply. Only templates available to that site collection will be available. By default SharePoint only applied the blank site (web) template since you didn't specify one when creating. It's a little workaround, but if for some reason your admins have an issue about adding templates to the global gallery you can still use your local site (web) templates with a little work.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
March 2018
Categories |