"Original" SharePoint development list definition for one development can be deployed multiple times

Source: Internet
Author: User

In SharePoint development, lists are a handy and headache feature that makes it easy to customize the list's columns with a browser, including column types and attempts, and the headache is that it's not very good to deploy to a production environment. The first time you can use a database restore, but to add changes, it is very troublesome, can only be in the development environment first, and then re-match in the production environment again, if not carefully match the wrong, but also very troublesome, may have to debug half a day to find the problem. Also, if more than one person develops a project together, it can be cumbersome to merge their own modifications to the list.

In short, if directly in the production of use, it is very convenient, but for developers, it is more painful.

Think for a long time, also looked up a lot of information, finally found a good solution for developers, is to develop a list template through Visual Studio , deployed to the system, manually or through a script to create a listing instance, The list instances in the system are automatically updated according to the template if the modification list is modified by modifying the list template in the VS project rather than by OOB.

In this way, when multi-person development, you can use TFS Unified to maintain the list template, in their development environment development as long as the deployment of the latest code, is the most up-to-date list, from the development of multiple deployment to production environment, as long as the deployment of the solution, create a new list instance is ready, Does not need to be configured through the browser again and again.

The tricky part of this approach is that theVS configuration List is not convenient for browsers or SPD , especially for Lookup fields, which need to be modified Schema.xls To specify the list and Showfield fields for the Lookup field , where list specifies the GUID value, sets the view Can only be done by changing the schema .

See if I can create and export a schema from SPD first ?

Overall, for developers, the benefits outweigh the disadvantages, the list only needs to be configured once, and subsequent deployment production synchronization is easy.

The detailed procedure is as follows:

    1. Add a new project to the VS project, select the list

Enter list name, select list template type

    1. After creating the list, set the column and column type of the list, the column name is first entered in English, then changed to Chinese, so that the subsequent development in the code reference, if the direct Chinese, the subsequent reference to the list column in Chinese UNICODE, very cumbersome and not intuitive.

    1. In the VS Solution Browser You can see a list of several files including

List1instance->elements.xml

Elements.xml

Schema.xml

In this can say a few more, in the Sharepoint list has the list template and the list instance two concepts, the list template defines the structure of the list, for example, a new list in the browser can see many list templates, such as custom lists, tasks, etc. And the list instance is the actual list in the site, each site instance is created based on the list template, when the template changes, the instance will be modified, a bit like the class and class objects.

In this case, in order to ensure that the solution is repeatedly deployed without causing the site's existing list instances to be destroyed, that is, the data of the existing list will not be deleted, you can delete the listinstance file directly, so that only the list template is updated at deployment time. The list instance is automatically refreshed with the new template.

The focus ison Schema.xml, which has a detailed List Schema Introduction on MSDN .

For the Lookup field, we need to find the corresponding field in the Schema.xml file, set the List and showfield fields, for example:

Where the GUID of list can be connected to the Sharepoint site by VS . The ID attribute of the View list : Tools, connect to Sharepoint

"Original" SharePoint development list definition for one development can be deployed multiple times

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.