Custom SharePoint new website creation process (1)

Source: Internet
Author: User

Why do we need to customize the creation process of a new SharePoint website? It has many functions. One of them is that we have created a new SharePoint Application Component and want the SharePoint administrator, you can use our new application components in the new website.

Sharepoint Server 2007 also uses this method. For example, if you want to use records management-related functions, you can use the record Center website template to create a new website. In the new website, the interface and content are customized according to the requirements of records management. Users can start their work directly based on the pre-fabricated content in the new website.

You can create a new SharePoint website in either of the following ways:

1. Feature stapling
2. Custom site definition + site provisioning Engine

SharePoint products use the second method in large quantities. We can also create a custom site definition like this, and then let the user select the site definition we created when creating a new website as shown in. Creating a custom site definition is a tedious task, especially if you still need to use the SharePoint provisioning engine for more "advanced" adjustments. Fortunately, Sharepoint solution generator reduces the complexity of creating site definition to some extent.

But I personally suggest you use the first method. :) So today I will first introduce feature stapling.Article.

Feature stapling, also known as feature/site template Association, is used to associate a feature with a website template without the need for the template definition to include the feature. For example, there is a site definition like "workgroup Website" in the system. We hope this template can contain a self-developed "feature XYZ ", however, I do not want to change the site definition of the "workgroup Website" directly on the disk. In addition to using the second method mentioned above (that is, adding a new site definition such as "Working Group website with feature XYZ" on the basis of "Working Group website ), with feature stapling, we can associate our "feature XYZ" with the "workgroup Website" site definition, as if the "workgroup Website" site definition already contains "feature XYZ.

To implement feature stapling, you must create at least two feature entries. The first feature is called the feature stapler, which is a feature used to associate the feature with the website template, the first feature is the feature itself (that is, the "feature XYZ" mentioned above ").

Because feature has event processingProgramTherefore, by adding event handlers to the feature that completes the actual function for 2nd, we can actually use feature stapling to complete some very complex tasks. For example, add several lists to a website and add some predefined users to the website.

Someone once asked me this question: How do I modify the "my website" style of all users? For example, add a self-developed web part on the "my website" homepage, or simply replace "my website" with what you want? Feature stapling is a good solution. We only need to associate one or more feature to the website template used by "my website". In this way, when each user visits "my website" for the first time and creates "my website" for it, the associated feature can be completed through its event handler, achieve the desired effect.

Next is my favorite instance demonstration link. :)

The demo scenario is that when you create a new website using the SharePoint built-in "workgroup Website" template, you want to automatically display a contact list on this new website, and it contains some raw data.

First, create feature stapler:

Feature. xml:
<Feature id = "feature" Title = "STS #0 feature stapling" Scope = "Farm" version = "1.0.0.0" hidden = "false" defaultresourcefile = "core" xmlns = "http://schemas.microsoft.com/sharepoint/ ">
<Elementmanifests>
<Elementmanifest location = "sts0featurestapling \ elements. xml"/>
</Elementmanifests>
</Feature>

Elements. xml:
<Elements id = "55b76996-827f-4879-b0d1-baddccdc8aac" xmlns = "http://schemas.microsoft.com/sharepoint/">
<Featuresitetemplateassociation id = "1d68910c-b227-4cba-bfa7-87896d812dcf" templatename = "STS #0"/>
</Elements>

Then, the feature used to complete the work:

feature. XML:
Title = "team site init"
scope = "Web"
Version = "1.0.0.0"
activateondefault = "false"
hidden = "false"
defaultresourcefile = "core"
receiverassembly = "featurestaplingsample, version = 1.0.0.0, culture = neutral, publickeytoken = 9f4da00rjc38ec5 "
receiverclass =" featurestaplingsample. featurecode. teamsiteinitfeaturereceiver "
xmlns =" http://schemas.microsoft.com/sharepoint/ "/>

The above feature uses an event handler for actual work.CodeIt will not be pasted.

Download the complete source code (vs2008 + vsewss 1.2 required ).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.