How to: Create a Custom List Definition
来源:互联网 发布:python什么是 函数对象 编辑:程序博客网 时间:2024/05/16 09:30
This task demonstrates how to create a custom list template feature and add it to the selection of lists available for creating on theCreate Page. Adding a custom list feature requires that you provide at least the following three files:
Feature.xml registers the list template.
Elements.xml adds the list template to the Create Page.
Schema.xml defines the list schema, which includes content type associations, field and view definitions, and form and toolbar references.
Procedures
To add a custom list definition to a Web site
Create a folder in Local_Drive
:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATES\FEATURES
and give it an appropriate name, such as SimpleListFeature.In the new folder create a Feature.xml file that specifies the title, ID, and scope for the Feature, as well as the location of an Elements.xml file, such as follows:
<Feature Title="Simple List Feature" Id="80E23615-3145-4f43-BD5E-8524C02BD6CD" Scope="Web" xmlns="http://schemas.microsoft.com/sharepoint/"> <ElementManifests> <ElementManifest Location="Elements.xml" /> </ElementManifests></Feature>
- To replace the GUID placeholder in the previousId attribute, generate a GUID by running guidgen.exe, located inLocal_Drive
:\Program Files\Microsoft Visual Studio 8\Common7\Tools
. In the new folder create an Elements.xml file that identifies the list template and specifies information to display on theCreate Page. Give it a Type value that is above 10000 and different from any other custom list definitions used in your deployment:
<Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <ListTemplate Name="SimpleList" DisplayName="Simple List" Type="10001" Description="This is my simple list." BaseType="0" OnQuickLaunch="FALSE" SecurityBits="11" /></Elements>
- Create a subfolder that has the same name as that assigned to the list template in the previous step, for example, SimpleList.
Create a Schema.xml file in the new subfolder to define the list. You can copy and modify the Schema.xml file of an existing list Feature to define special fields for a custom list definition.
At a command prompt, type the following commands to install the Feature in the deployment, and then activate the Feature on a specified subsite.
a. stsadm -o installfeature -filename SimpleListFeature\Feature.xml b. stsadm -o activatefeature -name SimpleListFeature -url http://Server/Site/Subsite
- To test the new Feature, navigate to theCreate Page and create a list through the template.
Schema.xml File
Define any custom fields that are required for your list near the beginning of theSchema.xml file. The following example, which copies and modifies the Schema.xml file of the defaultCustomList Feature, defines a special Choice field for the SimpleList Feature and adds this field to theItem content type so that the field is displayed in item forms.
To customize the Item content type definition, find the following content type declaration near the beginning of your copied Schema.xml file:
<ContentTypeRef ID="0x01"> <Folder TargetName="Item" /></ContentTypeRef>
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\ctypes
.Add a reference for your custom field to the content type definition, which in this example is called FavoriteColor. Also include the defaultFolder element to specify the resource folder for the content type. Create a unique ID for your content type as described inContent Type IDs. Use guidgen.exe as describe previously in step 3 to create GUIDs for the content type ID and for the field reference.
<List Name="SimpleList" Title="Simple List" BaseType="0" Direction="" Url=""> <MetaData> <ContentTypes> <!--Copy the referenced ContentType definition from ctypeswss.xml.--> <ContentType ID="0x010099FE4F3ACD494e30A36693F9EE65BAF2" Name="FavoriteColor Item" Group="$Resources:List_Content_Types" Description="Favorite color item content type." Version="0"> <FieldRefs> <FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" Required="TRUE" ShowInNewForm="TRUE" ShowInEditForm="TRUE"/> <!--Add a field reference for the custom field.--> <FieldRef ID="{AD22016D-BC8B-4631-A0A3-5E84C6CFA7EC}" Name="FavoriteColor" Required="TRUE" ShowInNewForm="TRUE" ShowInEditForm="TRUE"/> </FieldRefs> <XmlDocuments> <XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms"> <FormTemplates xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms"> <Display>ListForm</Display> <Edit>ListForm</Edit> <New>ListForm</New> </FormTemplates> </XmlDocument> </XmlDocuments> <!--Include the relative folder path for the content type resource folder.--> <Folder TargetName="Item" /> </ContentType> <ContentTypeRef ID="0x0120" /> </ContentTypes>
<Fields> <Field Type="Choice" Name="FavoriteColor" DisplayName="Favorite Color"> <CHOICES> <CHOICE>Red</CHOICE> <CHOICE>Green</CHOICE> <CHOICE>Blue</CHOICE> </CHOICES> </Field> </Fields> <Views> ...
<ViewFields> <FieldRef Name="Attachments"/> <FieldRef Name="LinkTitle"/> <FieldRef Name="FavoriteColor"/></ViewFields>
http://msdn.microsoft.com/en-us/library/ms466023(v=office.12).aspx
- How to: Create a Custom List Definition
- How to: Create a Custom Action Specific to a List
- How to - Create a custom layout manager for a screen
- How to create readonly columns in MOSS 2007 custom list
- .Net Windows Forms: How to Create a Custom Print Dialog
- .Net Windows Forms: How to Create a Custom Print Dialog
- .Net Windows Forms: How to Create a Custom Print Dialog
- How to create a custom notification on Android
- Creating a Custom SharePoint 2007 List Definition
- SharePoint2010 create custom list definition(SharePoint基于custom content type创建list definition)
- How to create custom price in Magento?
- Python: how to create a list of n lists [[],[],[]]
- How To - Create a custom field using attributes of other UI objects
- 改进:How To - Create a custom field using attributes of other UI objects
- How to create a custom directory for app files inside the ~/Library/Application Support directory.
- Docker - How to create a custom database from docker mysql image
- How To Create a Custom Salesforce Communities Login and Landing Page
- How to Create a Customer
- extjs中的JS代码在firefox可以正常运行,在IE中无法运行的方法。
- 获取数据字典 存储过程
- JavaScript基础学习笔记(三)——JavaScript 比较和逻辑运算符、JavaScript If...Else 语句、JavaScript Switch 语句
- Android SDK核心包简介
- c++ 中读取写入外部txt文件
- How to: Create a Custom List Definition
- 一个路径相对于另一个路径
- 康托展开
- 'IplImage' : missing storage-class or type specifiers
- java中自动生成注册码的代码
- 在X下动态更改分辨率的工具——xrandr
- windows 平台socket客户端
- 企业一定要在变革中生存,在变革中发展
- hadoop心跳机制解析