Wss3sdk: how to add a column to the list

Source: Internet
Author: User

You can specify a column in the list definition so that WSS will include this column in the list created by default each time you create a list of this type. The list definition can be included in feature.

After creating a new list, you can use the WSS object model to add a column to the list.

Specify columns in the list definition

To add a column to the list definition (as part of the feature), you must add the required XML elements to the list definition. Then, when you create a list of this type, this column appears in the list created by default.

Steps:

1. In the list definition XML fileFieldsAddFieldElement.

2. Define the field as needed and set the fieldFieldThe attribute of the element.

If you want to modify the columns in the created list, WSS will not write the changes back to the XML column definition. On the contrary, WSS saves the changes to the entries in the WSS database.

Add a column to the created list

We can use the WSS object model to add columns to an existing list through programming.

Procedure:

1. on a specific listFieldsAttribute to access the set in the list bar. This method returnsSpfieldcollectionObject.

2. Add a new column to the list using one of the following methods of the spfieldcollection object:

    • Microsoft. Sharepoint. spfieldcollection. Add (Microsoft. Sharepoint. spfield)
    • Microsoft. Sharepoint. spfieldcollection. Add (system. String, Microsoft. Sharepoint. spfieldtype, system. Boolean)
    • Microsoft. sharepoint. spfieldcollection. add (system. string, Microsoft. sharepoint. spfieldtype, system. boolean, system. boolean, system. collections. specialized. stringcollection)
    • Microsoft. Sharepoint. spfieldcollection. addfieldasxml (system. String)
    • Microsoft. Sharepoint. spfieldcollection. addfieldasxml (system. String, system. Boolean, Microsoft. Sharepoint. spaddfieldoptions)
    • createnewfield (system. String, system. String)

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.