共用方式為


SPContentTypeId.Parent property

取得目前的內容類型識別碼是直接階的內容類型識別碼 (ID)。

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'宣告
Public ReadOnly Property Parent As SPContentTypeId
    Get
'用途
Dim instance As SPContentTypeId
Dim value As SPContentTypeId

value = instance.Parent
public SPContentTypeId Parent { get; }

Property value

Type: Microsoft.SharePoint.SPContentTypeId
代表父項識別碼內容類型識別碼

備註

內容類型識別碼的設計被用來為遞迴。內容類型的識別碼封裝該內容類型,歷程或上層內容類型的內容類型繼承的列。每個內容類型識別碼包含上層內容類型,接下來包含該內容類型與其父系等等的 ID 的 ID、 最終回到及所有內容類型識別碼的根目錄,包括System內容類型識別碼。剖析的內容類型識別碼,您可以決定相關內容類型的歷程及如何兩個內容類型。

For more information, see Content Type IDs.

注意事項注意事項

System內容類型識別碼為父代本身擷取。它也是父代為Empty內容類型識別碼。

Examples

下列範例會顯示追蹤名為Document內建的內容類型識別碼的血脈主控台應用程式。

Imports System
Imports Microsoft.SharePoint

Module ConsoleApp

    Sub Main()

        Dim child As SPContentTypeId = SPBuiltInContentTypeId.Document
        Dim parent As SPContentTypeId = child.Parent
        Dim grandparent As SPContentTypeId = parent.Parent

        Console.WriteLine(grandparent.ToString())
        Console.WriteLine(parent.ToString())
        Console.WriteLine(child.ToString())

        Console.Write(vbCrLf & "Press ENTER to continue....")
        Console.Read()
    End Sub
End Module
using System;
using Microsoft.SharePoint;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            SPContentTypeId child = SPBuiltInContentTypeId.Document;
            SPContentTypeId parent = child.Parent;
            SPContentTypeId grandparent = parent.Parent;

            Console.WriteLine(grandparent.ToString());
            Console.WriteLine(parent.ToString());
            Console.WriteLine(child.ToString());

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

應用程式會在列印下列輸出至主控台。

0x
0x01
0x0101

Press ENTER to continue...

請參閱

參照

SPContentTypeId structure

SPContentTypeId members

Microsoft.SharePoint namespace

IsParentOf(SPContentTypeId)

SPBuiltInContentTypeId

其他資源

Content Type IDs

Introduction to Content Types

Site and List Content Types

Base Content Type Hierarchy