SharePoint [Study Notes]-[upgrading & version upgrade]: content type feature (II. content type feature modification and Version Upgrade

Source: Internet
Author: User

One of the benefits of sharepoint2010 is that it greatly improves the feature version management capability. We can use visual studio2010 to control and upgrade the developed feature versions. Content type is used as an example to demonstrate the version control and upgrade functions of content type feature. In the previous article, we used vs2010 to create a content type feature and deploy it on our website. At that time, we specified its version number as 1.0.0.0. In this article, we need to modify the feature because of a change in user requirements. The modified version number will be 2.0.0.0 and the previous version 1.0.0.0 will be upgraded.
The procedure is as follows:
1. Use Visual studio2010 to open the created SharePoint project testupgradablect.
Add a new element (newfieldversion2) in this project. This element is our new change to feature.

 

2. Modify the element. XML content of this element as follows:

<? XML version = "1.0" encoding = "UTF-8"?>
<Elements xmlns = "http://schemas.microsoft.com/sharepoint/">
<Field ID = "{4a977aa8-802b-4e4e-8003-cc48be5ef66e }"
Name = "note2"
Staticname = "note2"
Displayname = "Note on version 2"
Type = "NOTE"
Group = "a feature Upgrade Attempt"/>
</Elements>

 

3. Add the newly created element to our contenttype feature. The method is
 

3. 1. Expand the features node in vs2010 and edit its feature. template. XML document.

 

Modify the content as follows:

<? XML version = "1.0" encoding = "UTF-8"?>
<Feature xmlns = "http://schemas.microsoft.com/sharepoint/">
<Upgradeactions>
<Versionrange beginversion = "1.0.0.0" endversion = "4.0.0.0">
<Applyelementmanifests>
<Elementmanifest location = "newfieldversion2/elements. xml"/>
</Applyelementmanifests>

<Addcontenttypefield
Contenttypeid = "0x0101000dca415159f044bba9feb7f6d1abad4c"
Fieldid = "{4a977aa8-802b-4e4e-8003-cc48be5ef66e }"
Pushdown = "true"/>
</Versionrange>
</Upgradeactions>
</Feature>

Note:
The <upgradeactions> section tells SharePoint that the feature content contained in this section is what we want to use for upgrade.
<Versionrange beginversion = "1.0.0.0" endversion = "4.0.0.0"> when SharePoint detects an increase in the feature version, and the new version number is between 1.0.0.0 and 4.0.0.0 (that is, the specified range value), the upgrade will be performed.
<Applyelementmanifests> specifies the list of elements to be applied during the function upgrade. Here, we specify the elements. XML element under the newfieldversion2 Directory, which is the new element we just added.
<Addcontenttypefield> specifies the content type field to be added during feature upgrade. The contenttypeid is the ID of the content type feature developed here, fieldid is the ID of the new elment element we just added. Pushdown is an optional attribute and the type is boolean. Here we specify that the content type field should be applied to the inherited content type and list.

3.2 modify the feature version to 2.0.0.0, and then re-build and deploy it.

Go back to our test website, siteactions --> sitesettings, and select the sitecontent type item under galleries.

Select the zlupgradablect we developed to go to its settings page.

 

On the settings page, select Add from existing site columns.

 

 

Add the new element in the upgraded version. In the feature Upgrade Attempt group, You Can See note on version2. Select this option to add it to the list box on the right.

 

Then perform a test similar to the previous one. You can see that the feature upgrade takes effect.

 

 

 

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.