Question

I'm creating a site that I'll eventually use as a template to create other sites from it. The site will contain lists, workflows, user groups, content types etc etc.

I want to make lots of clones from it with identical functionality.

What do I have to pay attention to in order to successfully use it as template? I'm looking for advices like for example: "don't use hard codded URLs in your custom code".

Était-ce utile?

La solution

I would consider looking at Web Templates - see Anders Rask's slide deck & code from #SPSUK http://sites.wizdim.com/andersrask/sharepoint-2010/slide-decks-and-demo-code-from-my-sharepoint-saturday-uk-session/

In essence, save as a site template, import to Visual Studio and package up with the appropriate elements (cutting out elements you don't really need).

You can upgrade the solution more easily at a later date.

Autres conseils

Some things from my experiences:

  • Don't use hard coded values in workflow notifications.
  • Document all changes you make to the template and where it's been deployed so you know what to apply, where.
  • Enhancements and bug fixes are going to be a management concern going forward as once the site is provisioned from the template, there is no inheritance. If you need to add a workflow down the road to a list, it has to be added everywhere the template has been used if it's deemed necessary functionality for everyone.

If you really want to use Site Templates instead of Web Templates (a perfectly viable solution in certain specific scenarios) there is a guide here that tells you what gets packaged and what doesnt (glancing at that list my guess is it is not complete, custom fields for example i'm pretty sure is not supported!)

Included in user solution WSP

  • Lists
  • Libraries
  • External Lists
  • Data source connections
  • List views and data views
  • Custom forms
  • Workflows
  • Content Types
  • Custom Actions
  • Navigation
  • Site pages
  • Master pages
  • Modules
  • WebTemplates

Not included in user solution WSP

  • Customized permissions
  • Running workflow instances
  • List item version history
  • Workflow tasks associated with running workflows
  • People/group field values
  • Taxonomy field values
  • Publishing pages and publishing sites
  • My Sites

You will want to use a Web Template for the base site, but then you will want to consider additional features to cover some of the other dependencies and customizations. The secondary features can provide a great way to maintain the customizations over time and also does a better job of ensuring that any dependencies are already in place. Those secondary features can be set to hidden so that they are only activated or dactivated via code (feature receivers) and not through the UI.

Check out Vesa Juvonen's blog post on this: http://blogs.msdn.com/b/vesku/archive/2010/10/14/sharepoint-2010-and-web-templates.aspx

Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top