SharePoint Content Type ID

Content types are little gems within SharePoint with many useful characteristics.  The one

characteristic is that content types support inheritance.  For the non programmers;

inheritance is when you define acontent type it must be based on an existing content type. 

The new type called the child type will get all the features, i.e. fields, settings of the parent

type.  The child type can then have additional types.

To illustrate this, let us say we have a business that has customers and suppliers and we need

to store customers and suppliers.  We could easily create a content type for a Customer that

inherits from Contact, however a customer has an additional Account number field and Account

Manager field. 

The Supplier is also a contact and thus inherits from contact, however it has a Customer Number

field.

At this point it is important to note that content types inherit from other content types and build

a tree as shown in the diagram below:

image

You can create your own content types that inherit from other content types in CAML by

understanding the ID field. Each content type must have a unique id, however unlike many

other ID's that are Globally unique identifiers, a content type ID is a mixture of the parent ID,

shown in the table below an a unique GUID.  Also the GUID is contains no braces or dashes

like other GUIDS.

Content Type

 

 

ID Start

 

 

System

 

 

0x

 

 

Item

 

 

0x01

 

 

Library Content Types

 

 

 

 

Document

 

 

0x0101

 

 

Form

 

 

0x010101

 

 

Picture

 

 

0x010102

 

 

WikiDocument

 

 

0x010108

 

 

BasicPage

 

 

0x010109

 

 

WebPartPage

 

 

0x01010901

 

 

List Content Type

 

 

 

 

Event

 

 

0x0102

 

 

Issue

 

 

0x0103

 

 

Announcemnt

 

 

0x0104

 

 

Link

 

 

0x0105

 

 

Contact

 

 

0x0106

 

 

Message

 

 

0x0107

 

 

Task

 

 

0x0108

 

 

BlogPost

 

 

0x0110

 

 

BlogComment

 

 

0x0111

 

 

Folder Content Types

 

 

 

 

Folder

 

 

0x0120

 

 

RootOfList

 

 

0x012001

 

 

Discussion

 

 

0x012002

 

 

Where to set the ID

When you define your content type in the Elements manifest file, there is a mandatory

ID field which needs to be the content type.  A snipit of a content type is shown below:

<?xml version="1.0" encoding="utf-8"?> 
<
Elements xmlns="http://schemas.microsoft.com/sharepoint/"
  <
ContentType 
   ID="0x0106000BB3F82D2A624B77833C28045F765D7A
    > 

  </
ContentType
</
Elements>

The syntax is :

Parent ID + 00 + GUID

Examples

  1. To create a content type with GUID {0BB3F82D-2A62-4b77-833C-28045F765D7A} 

      that is based on contact (0x0106), you would se the ID to 
      0x0106000BB3F82D2A624B77833C28045F765D7A

  1. To create a content type with GUID {0E3E8F35-3A21-4ed7-8151-816C48E2D64F}

       that is a based on document (0x0101), you would set the ID to 
      0x0101000E3E8F353A214ED78151816C48E2D64F

  1. To create your own item with GUID {A6C62A39-E374-4d8d-9EFE-90DD65B659F9}

       that is based on item (0x01), you would set the ID to 
       0x0100A6C62A39E3744D8D9EFE90DD65B659F9

转自:http://www.cnblogs.com/timoli/archive/2010/01/11/1644048.html

posted @   StarWang  阅读(682)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
阅读排行:
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 零经验选手,Compose 一天开发一款小游戏!
· 一起来玩mcp_server_sqlite,让AI帮你做增删改查!!
点击右上角即可分享
微信分享提示