共用方式為


Deciding Between Multiple Definitions or Multiple Configurations

Applies to: SharePoint Foundation 2010

If you need more than one custom site type, and you determine that your custom site types cannot be created by using web templates, you must create one or more custom site definitions. (For more information about this choice, see Deciding Between Custom Web Templates and Custom Site Definitions.) The next question is whether to create an entirely separate custom site definition for each of your site types, or to create a single site definition with separate configurations within it for each custom site type.

Common Aspects of All Configurations in a Site Definition

The following list contains the aspects of a site type that all site configurations within a specific site definition share. If your custom site types should all be the same in the following respects, you should create a single site definition, with multiple configurations within it. If two or more of your custom site types must be different in one or more of the following respects, you must create separate site definitions. The items on this list are easier to understand after you have practiced creating custom site definitions and configurations. For more information about the process, see How to: Create a Custom Site Definition and Configuration.

The general, but not quite universal, rule that determines what goes in the following list is that configurations within a site definition share aspects that are defined by either (1) elements of the site definition’s Onet.xml file that are peers of the Configurations element, or (2) attributes of the Project element that is a parent of the Configurations element.

  • The presence and organization of the navigation bars and trees on the site pages of the websites that are created from your custom site types.

  • The footer on email messages that are sent from the websites.

  • The file dialog post processor, if any, that is used by the websites.

  • The external security provider, if any, that is used by the websites.

  • The cascading style sheets (CSS) styles that govern much of the appearance of the website pages.

  • The design of the header area of the website pages.

  • The custom ECMAscript, if any, that will run in the website pages.

  • The disabling, for the websites, of some types of design actions that can otherwise be performed with designer applications, such as Microsoft SharePoint Designer.

  • The logo of the websites.

  • The default name of the websites. (Users typically specify a name when they create a website, so this string would rarely be used.)

  • The name of the folder in which new lists are created on the websites.

Strictly speaking, other aspects of site types are defined outside the Configurations element; however, these aspects can be differentiated configuration-by-configuration anyway, so the need to individuate site types in any of the following respects should not prevent you from using multiple configurations within a single site definition.

  • The set of files used by the site type, including site page (.aspx) files, such as the home page. These are defined in a Modules element that is a peer of the Configuration element; however, a given module is present in a site type only if it is referenced from within the site type’s Configuration element.

  • The set of "all users" Web Parts that are used by the site type. These are defined in a Modules element that is a peer of the Configuration element; however, a given module is present in a site type only if it is referenced from within the site type’s Configuration element.

  • The set of available document templates that are used in document libraries. These are defined in a DocumentTemplates element that is a peer of the Configuration element; however, the fact that a document template is available does not mean that users have to use it. Hence, the fact that all configurations share the same pool of document templates is only a concern if, for some reason, you wanted to block a particular template from being available on one type of site, and that same template must be available on another of your custom site types.

See Also

Tasks

How to: Create a Custom Site Definition and Configuration

Concepts

Overview of Creating Custom Site Definitions