Udostępnij za pośrednictwem


Base Content Type Hierarchy

Applies to: SharePoint Foundation 2010

Available in SharePoint Online

Microsoft SharePoint Foundation 2010 includes many built-in content types. All but one of these content types are derived from other built-in content types, and they can be organized in a hierarchy based on parentage. At the top of the hierarchy is the System content type. Next below System is the Item content type, which is derived from System and from which all other content types ultimately derive.

A partial list of the built-in content types is shown in the following table.

Name

ID

System

0x

Item

0x01

Document

0x0101

Event

0x0102

Issue

0x0103

Announcement

0x0104

Link

0x0105

Contact

0x0106

Message

0x0107

Task

0x0108

Workflow History

0x0109

Post

0x0110

Comment

0x0111

East Asia Contact

0x0116

Folder

0x0120

Notice that many of these base content types correspond to types of lists that you can create. This correspondence is by design. For more information, see Default List Content Types.

You can determine the line of descent for a content type by carefully inspecting its content type ID. For example, notice that all of the content types descended from Item have IDs that begin with the ID for Item. The ID for a child content type is formed by appending information to the ID of the parent content type. For more information, see Content Type IDs.

For a complete list of built-in content types, see the fields of the SPBuiltInContentTypeId class.

Rules of Assignment

The three most important built-in content types are Item, Document, and Folder. The reason these three types are important is that SharePoint Foundation enforces certain rules about how content types that are derived from them can be used. You can assign content types to list items, documents, and folders. However, any content type that you assign to a document library must inherit from Document or from a content type derived from Document. Moreover, any content type that you assign to a list must not derive from Document. The exception to this pair of rules is the Folder content type and its derivatives. Folders can exist on both lists and document libraries.

Content Type Groups

The built-in content types are organized in groups such as List Content Types, Document Content Types, Folder Content Types, and _Hidden. You can obtain the name of the group that a given content type belongs to by reading the Group property of an SPContentType object in server code or the same property of a ContentType object in client code.

Content types that belong to the "_Hidden" group are not displayed in the user interface for users to apply to lists or use as the basis for other content types. For more information, see Content Type Access Control.

You can find out which content types are available for assignment to lists and libraries, and how they are grouped, by viewing the Site Content Types gallery under Site Settings in the user interface. You can obtain a more complete listing—one that includes hidden content types—by writing server code such as the following console application.

using System;
using System.Collections;
using Microsoft.SharePoint;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            using (SPSite site = new SPSite("https://localhost"))
            {
                using (SPWeb web = site.OpenWeb())
                {
                    // Create a sortable list of content types.
                    ArrayList list = new ArrayList();
                    foreach (SPContentType ct in web.AvailableContentTypes)
                        list.Add(ct);

                    // Sort the list on group name.
                    list.Sort(new CTComparer());

                    // Print a report.
                    Console.WriteLine("{0,-35} {1,-12} {2}", "Site Content Type", "Parent", "Content Type ID");

                    for (int i = 0; i < list.Count; i++)
                    {
                        SPContentType ct = (SPContentType)list[i];

                        if (i == 0 || ((SPContentType)list[i - 1]).Group != ct.Group)
                        {
                            Console.WriteLine("\n{0}", ct.Group);
                            Console.WriteLine("------------------------");

                        }

                        Console.WriteLine("{0,-35} {1,-12} {2}", ct.Name, ct.Parent.Name, ct.Id);
                    }
                }
            }

            Console.Write("\nPress ENTER to continue...");
            Console.ReadLine();
        }
    }

    // Implements the Compare method from the IComparer interface.
    // Compares two content type objects by group name, then by content type Id.
    class CTComparer : IComparer
    {
        // The implementation of the Compare method.
        int IComparer.Compare(object x, object y)
        {
            SPContentType ct1 = (SPContentType)x;
            SPContentType ct2 = (SPContentType)y;

            // First compare group names.
            int result = string.Compare(ct1.Group, ct2.Group);
            if (result != 0)
                return result;

            // If the names are the same, compare IDs.
            return ct1.Id.CompareTo(ct2.Id);
        }
    }
}

When this application runs on a website that has only the built-in content types available, it generates the following output.

Site Content Type                   Parent       Content Type ID

_Hidden
------------------------
System                              System       0x
Health Analyzer Rule Definition     Item         0x01003A8AA7A4F53046158C5ABD98036A01D5
Health Analyzer Report              Item         0x0100F95DB3A97E8046B58C6A54FB31F2BD46
Office Data Connection File         Document     0x010100629D00608F814DD6AC8A86903AEE72AA
Universal Data Connection File      Document     0x010100B4CBD48E029A4AD8B62CB0E41868F2B0
User Workflow Document              Document     0x010107
Workflow Task                       Task         0x010801
Administrative Task                 Task         0x010802
Workflow History                    Item         0x0109
Person                              Item         0x010A
SharePointGroup                     Item         0x010B
DomainGroup                         Item         0x010C
RootOfList                          Folder       0x012001
Document Collection Folder          Folder       0x0120D5

Document Content Types
------------------------
Document                            Item         0x0101
List View Style                     Document     0x010100734778F2B7DF462491FC91844AE431CF
Form                                Document     0x010101
Picture                             Document     0x010102
Master Page                         Document     0x010105
Wiki Page                           Document     0x010108
Basic Page                          Document     0x010109
Web Part Page                       Basic Page   0x01010901
Link to a Document                  Document     0x01010A
Dublin Core Columns                 Document     0x01010B

Folder Content Types
------------------------
Folder                              Item         0x0120
Discussion                          Folder       0x012002
Summary Task                        Folder       0x012004

Group Work Content Types
------------------------
Circulation                         Item         0x01000F389E14C9CE4CE486270B9D4713A5D6
New Word                            Item         0x010018F21907ED4E401CB4F14422ABC65304
Resource                            Item         0x01004C9F4486FBF54864A7B0A33D02AD19B1
Official Notice                     Item         0x01007CE30DD1206047728BAFD1C39A850120
Phone Call Memo                     Item         0x0100807FBAC5EB8A4653B8D24775195B5463
Holiday                             Item         0x01009BE2AB5291BF4C1A986910BD278E4F18
What's New Notification             Item         0x0100A2CA87FF01B442AD93F37CD7DD0943EB
Timecard                            Item         0x0100C30DDA8EDB2E434EA22D793D9EE42058
Resource Group                      Item         0x0100CA13F2F8D61541B180952DFB25E3E8E4
Users                               Item         0x0100FBEEE6F0C500489B99CDA6BB16C398F7

List Content Types
------------------------
Item                                System       0x01
Event                               Item         0x0102
Reservations                        Event        0x0102004F51EFDEA49C49668EF9C6744C8CF87D
Schedule and Reservations           Event        0x01020072BB2A38F0DB49C3A96CF4FA85529956
Schedule                            Event        0x0102007DBDC1392EAF4EBBBF99E41D8922B264
Issue                               Item         0x0103
Announcement                        Item         0x0104
Link                                Item         0x0105
Contact                             Item         0x0106
Message                             Item         0x0107
Task                                Item         0x0108
Post                                Item         0x0110
Comment                             Item         0x0111
East Asia Contact                   Item         0x0116

Special Content Types
------------------------
Unknown Document Type               Document     0x010104

Press ENTER to continue...

See Also

Reference

SPBuiltInContentTypeId

Concepts

Default List Content Types

Content Type IDs

Creating Content Types

Content Type Access Control