【转】使用Feature构建(之二):Content Types
原文链接:http://www.cnblogs.com/zhalin/archive/2008/01/18/1044947.html
这里只描述xml文件,具体做法参见“使用Feature构建(之一):Site Columns"
<!--ContentTypes.xml-->
<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ContentType ID="0x01A0"
Name="ContentTypeName"
Group="ContentTypeGroup"
Description="ContentTypeDescription"
Version="0">
<FieldRefs>
<FieldRef ID="{EAFC93B2-F96F-4728-BB33-19C3B4311441}" Name="FieldName" Required="TRUE" />
<FieldRef ID="{D877015F-32D3-415a-AC71-79B9FA53AA47}" Name="FieldName" Required="FALSE" />
</FieldRefs>
</ContentType>
</Elements>ContentType ID的格式是:ParentContentTypeID + "00" + ChildContentTypeID
在这里,ParentContentTypeID=”0x01“, 这个是"Item"的ID。
Required="TRUE" 表示这个Field是必选的,Required="FALSE"表示该Field可以为空。其中TRUE或者FALSE必须是要大写。
ChildContentTypeID有两种方法可以构建,
其一是“GUID”, 记住把“-” 去掉,比如你的GUID是{A3A2E09B-83C7-4cf6-B19D-3F6B6590C844}
那么结果应该是:0x0100A3A2E09B83C74cf6B19D3F6B6590C844.
其二是十六进制的两个数字,可以自己定义,比如在上面例子里,我定义为A0,
结果是:0x0100A0
以下是所有默认SharePoint Content Type的ID列表:
| Item |
0x01 |
| Reusable HTML |
0x01002CF74A4DAE39480396EEA7A4BA2BE5FB |
| Reusable TEXT |
0x01004D5A79BAFA4A4576B79C56FF3D0D662D |
| Page Output Cache |
0x010087D89D279834C94E98E5E1B4A913C67E |
|
Document |
0x0101 |
| System page layout |
0x01010007FF3E057FA8AB4AA42FCB67B453FFC1 |
| Page layout |
0x01010007FF3E057FA8AB4AA42FCB67B453FFC100E214EEE741181F4E9F7ACC43278EE811 |
| System master page |
0x0101000F1C8B9E0EB4BE489F09807B2C53288F |
| Publishing master page |
0x0101000F1C8B9E0EB4BE489F09807B2C53288F0054AD6EF48B9F7B45A142F8173F171BD1 |
|
Office Data Connection File |
0x010100629D00608F814DD6AC8A86903AEE72AA |
|
Universal Data Connection File |
0x010100B4CBD48E029A4AD8B62CB0E41868F2B0 |
|
System Page |
0x010100C568DB52D9D0A14D9B2FDCC96666E9F2 |
| Page |
0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF39 |
| Article page |
0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900242457EFB8B24247815D688C526CD44D |
| Welcome page |
0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF390064DEA0F50FC8C147B0B6EA0636C4A7D4 |
| Redirect page |
0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900FD0E870BA06948879DBD5F9813CD8799 |
| Form |
0x010101 |
| Picture |
0x010102 |
| Unknown document type |
0x010104 |
| Master page |
0x010105 |
|
User Workflow Document |
0x010107 |
|
Wiki Page |
0x010108 |
| Basic page |
0x010109 |
| Web part page |
0x01010901 |
|
Link to a Document |
0x01010A |
|
Dublin Core Columns |
0x01010B |
| Event |
0x0102 |
| Issue |
0x0103 |
|
Announcement |
0x0104 |
| Link |
0x0105 |
| Contact |
0x0106 |
| Message |
0x0107 |
| Task |
0x0108 |
| Work flow task |
0x010801 |
|
Office SharePoint Server Workflow Task |
0x01080100C9C9515DE4E24001905074F980F93160 |
|
Administrative Task |
0x010802 |
|
Workflow History |
0x0109 |
| Person |
0x010A |
|
SharePointGroup |
0x010B |
| DomainGroup |
0x010C |
| Post |
0x0110 |
| Comment |
0x0111 |
|
Far East Contact |
0x0116 |
|
Folder |
0x0120 |
|
RootOfList |
0x012001 |
|
Discussion |
0x012002 |
This posting is provided "AS IS" with no warranties, and confers no rights.
浙公网安备 33010602011771号