Search This Blog

Thursday, March 17, 2011

SharePoint 2010 and web templates

More information on sharepoint 2010 Web templates


To create the initial web template:

  • Users create a web template by saving a website "as template" in the user interface (UI). This is also the easiest way for you as a developer to begin. In the UI, create a website of a type that is most similar to the custom site type that you are creating.
  • Add or delete lists, Web Parts, and other Features as needed until the website matches your idea for a custom site type as closely as possible using only the Microsoft SharePoint Foundation UI and Microsoft SharePoint Designer.
  • When you have the prototype website as close as you can get it to your custom site type, save it as a template on the Site Settings page. The web template is saved to the site collection's Solution Gallery. Do not use spaces in the template name.
  • If you need additional customization that cannot be done in the UI, follow the steps in the procedure "To set up a Visual Studio project."
To set up a Visual Studio project:
  • Deactivate the solution in the Solution Gallery.
  • Download the solution (.wsp) file from the Solution Gallery.
  • Delete the solution from the Solution Gallery.
Note:
You can also write code to save a website as a template and download the solution package directly to the local file system, bypassing the Solution Gallery altogether. For an example, see the SPSolutionExporter.ExportWeb method.

  • In Microsoft Visual Studio, create an Import SharePoint Solution Package project. Specify that the project is a sandboxed solution, not a farm solution.
  • When you are prompted to specify the project source, specify the path to the solution that you downloaded.
  • When you are prompted to select the items to import, select all the items or just the items that are needed, and then click Finish.
  • When Visual Studio finishes creating the project, highlight the project name in Solution Explorer. In the Property window, set the Include Assembly in Package property to false.
  • Edit the extracted files as needed. In most cases, you have to change only the WebTemplate element or the Onet.xml file. For more information, see the following procedures
To edit the WebTemplate element:

  • In Solution Explorer, under the Web template node, there is a subfolder that contains an Elements.xml file. Open this file.
  • Edit the WebTemplate child element of the Elements tag as needed. For information about the meaning of the attributes of the WebTemplate element, see WebTemplate Element (Web template).

 To edit the Onet.xml file:
  1. The Onet.xml file for the web template is located either in the same subfolder as the Elements.xml file that contains the WebTemplate element, or in a subfolder in the Other Imported Files node in Solution Explorer. Open the Onet.xml file.
  2. Edit the Onet.xml file as needed. Editing this file is basically the same as editing an Onet.xml file that is part of a site definition. (For more information, see How to: Create a Custom Site Definition and Configuration.) But note these differences:
  • The Project element in a web template's Onet.xml file has only two child elements: the NavBars element and the Configurations element. The BaseTemplateID attribute and the BaseTemplateName attribute of the WebTemplate element identify the site definition from which the web template is ultimately derived. The Onet.xml file of the web template depends on the Onet.xml file of that source site definition for all other child elements of the Project element, including ListTemplates, DocumentTemplates, Modules, ServerEmailFooter, and Components.
  • The Configurations element has only one child Configuration element.
  • Some of the attributes of the WebTemplate element have the same name as attributes of the Project element. Use the attributes in the WebTemplate element.
For more information about this file, see Understanding Onet.xml Files.

To package, upload, and test the custom web template:

  • In Visual Studio, on the Build menu, select Deploy Solution. If your development farm is a single-server farm, this builds the solution, repackages it, uploads it to the site collection's sandboxed solutions gallery, and activates it. If your development farm is multi-server, you must perform the activation step in the UI.
  • Test the custom web template by creating a website from it.

8 comments:

  1. At this time it appears like Drupal is the best blogging platform
    available right now. (from what I've read) Is that what you are using on your blog?
    Stop by my site : Cute Blonde Gets Rammed By Stud

    ReplyDelete
  2. I have read so many content regarding the blogger lovers except this paragraph
    is actually a fastidious piece of writing, keep it up.
    Feel free to visit my web site ; Free porn videos and naked girls hardcore sex

    ReplyDelete
  3. What i don't realize is in reality how you are no longer actually much more smartly-appreciated than you may be now. You're so intelligent.
    You already know thus significantly relating to this topic, produced me individually imagine
    it from numerous varied angles. Its like men and
    women are not involved unless it's one thing to do with Woman gaga! Your own stuffs nice. Always handle it up!
    Here is my web page : click through the up coming web site

    ReplyDelete
  4. It's going to be ending of mine day, except before ending I am reading this wonderful paragraph to increase my experience.
    my web site: www.bhgalleries.com

    ReplyDelete
  5. Good way of describing, and pleasant article to take data about my presentation subject, which i
    am going to present in academy.
    Also visit my web blog Smoking Hot Brunette Gets Really Wet

    ReplyDelete
  6. Greetings! Very useful advice in this particular article!

    It's the little changes which will make the biggest changes. Many thanks for sharing!
    Review my page - hookah bars in Orlando

    ReplyDelete
  7. Hmm is anyone else having problems with the pictures on this blog loading?
    I'm trying to find out if its a problem on my end or if it's the blog.
    Any feed-back would be greatly appreciated.

    Also visit my web blog :: contemplatif

    ReplyDelete
  8. Good information. Lucky me I ran across your blog by chance (stumbleupon).
    I've saved as a favorite for later!

    Also visit my website adult webcam live chat

    ReplyDelete