Geeks With Blogs

Know SharePoint

The problem
As you might know, Site Definitions are not supported on Office365. This is not a restriction of Office365 as such, but more a Sandboxing restriction. In a SharePoint 2010 Sandboxed environment you’re not allowed to deploy files to the file system. And a SharePoint Site Definition requires that.

The answer lies in the newly introduced web template tag. In this post I will describe, step by step, how to create a web template, and how to create a new Site Collection based on that web template.

So, if I have create a Web Template instead of a Site Definition, what is the problem?
Office365 is a sandboxed environment. That means that if you create a web template, and you packaged it nicely in a WSP file, you can upload that WSP to the solutions gallery of your site collection and activate it. After activation you have a template available to create the site from. And there we have a catch-22. What if the site we upload the solution package to, so the site itself, needs to be based on a webtemplate? In a on premise environment, where you are farm administrator, you simply upload the package to your farm, activate a feature on WebApplication level that installs the template and of you go. But that level of access you don’t have in Office365 or any other Sandboxed environment.

The solution

  1. Create a new SharePoint project (I picked a empty one for this example).
  2. Enter a url of a site on your local server.
    When asked for the trust level, pick “Deploy as a sandboxed solution”.
  3. Add a new Empty Element to your project
  4. IMPORTANT: The name of the element should be *IDENTICAL* to the name of the Web Template you’re creating.
  5. You will end up with an empty “elements.xml” file in your editor.
  6. Create a new WebTemplate entry as follows:

    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="">
      Name="Root Site"
      Title="Root Site"
      DisplayCategory="Company Templates"
      Description="Company Root Site Template"
  7. Notice the Name property of the tag. That name should be identical to the name you used for the element in step 4.
  8. The BaseTemplateID is the ID of the Out of the box site definition. You can find those definitions in


    If you have additional language packs installed on your server, like for instance Swedish, then there are other folders.
  9. Open the WEBTEMP.XML file and find the site definition you want to base your webtemplate upon. I picked the Blank site definition (STS), and that definition has an ID of 1. Set that value of the BaseTemplateID property.
  10. The BaseConfigurationID property is the configuration you want to use . The configuration and what is performed in it can be found in

  11. Provide values for the other properties as appropriate and you are almost done.
  12. If you want to use an ONET.XML file, you can. Copy an existing onet.xml file (or, if you want/can, create a new one from scratch) and add it to your newly created element. Mark the file as an ElementFile, as in the screenshot below:

  13. As Visual Studio automatically created a feature for you and added this elements file to the feature, its now just a matter of packaging your solution and you’re ready to deploy it to Office365.


Now, in order to use this newly created webtemplate for a new Site Collection, act as follows:

  1. Log on as administrator of Office365 and create a new site collection. When asked for the template, switch to the custom tab and pick “<Select template later…>”
  2. Wait until the site is created and click on the link to browse to it. You will be asked to pick a template. Do not pick the template, but go to the Site Settings by opening


  3. Open the solutions gallery, upload your solution package (WSP file) to the gallery and activate it.
  4. Now browse again normally to your site, and again you will asked to pick a template. And now, finally, your template will be available for selection. Pick it and your site will be created just the way you want it.
Posted on Thursday, February 9, 2012 2:25 AM Office365 , SharePoint | Back to top

Comments on this post: Creating a Site Collection from your own WebTemplate on Office 365

# re: Creating a Site Collection from your own WebTemplate on Office 365
Requesting Gravatar...
Thank you very much, this is what I needed!
Left by Karine Bosch on Apr 10, 2014 1:26 PM

# re: Creating a Site Collection from your own WebTemplate on Office 365
Requesting Gravatar...
This post is very much helpful to know how to create a Site Collection from my own WebTemplate on Office 365. catalina island hotels I think such posts are important to learn about this procedure. Thank you so much for sharing this post here!
Left by kevin on Mar 01, 2016 4:55 AM

Your comment:
 (will show your gravatar)

Copyright © Erwin van Hunen | Powered by: