Поделиться через


Метод SPContentTypeId.ToString

Указывает, произошла ли ошибка после проверки значений для поля.

Пространство имен:  Microsoft.SharePoint
Сборка:  Microsoft.SharePoint (в Microsoft.SharePoint.dll)

Синтаксис

'Декларация
Public Overrides Function ToString As String
'Применение
Dim instance As SPContentTypeId
Dim returnValue As String

returnValue = instance.ToString()
public override string ToString()

Возвращаемое значение

Тип: System.String
Строка, представляющая идентификатор типа контента. Первые два разряда строки, всегда «0 x».

Замечания

Строка, возвращаемая функцией этот метод может быть полезен для понимания природы рекурсивный идентификаторов типов контента. К примеру следующий код получает идентификатор типа контента из типа контента списка и использует этот идентификатор для определения обратно три поколения идентификаторы типов контента. После сбора всех четырех идентификаторы приложение выведет их строковые значения на консоль.

SPContentTypeId child = web.Lists["Announcements"].ContentTypes["Announcement"].Id;
SPContentTypeId parent = child.Parent;
SPContentTypeId grandparent = parent.Parent;
SPContentTypeId greatgrandparent = grandparent.Parent;
Console.WriteLine("Greatgrandparent id: {0}", greatgrandparent.ToString());
Console.WriteLine("     Grandparent id: {0}", grandparent.ToString());
Console.WriteLine("          Parent id: {0}", parent.ToString());
Console.WriteLine("           Child id: {0}", child.ToString());
Dim child As SPContentTypeId = web.Lists("Announcements").ContentTypes("Announcement").Id
Dim parent As SPContentTypeId = child.Parent
Dim grandparent As SPContentTypeId = parent.Parent
Dim greatgrandparent As SPContentTypeId = grandparent.Parent
Console.WriteLine("Greatgrandparent id: {0}", greatgrandparent.ToString())
Console.WriteLine("     Grandparent id: {0}", grandparent.ToString())
Console.WriteLine("          Parent id: {0}", parent.ToString())
Console.WriteLine("           Child id: {0}", child.ToString())

Этот код выводит следующие выходные данные на консоль.

Greatgrandparent id: 0x
     Grandparent id: 0x01
          Parent id: 0x0104
           Child id: 0x0104009010BFF57D431540B197B8058EBC3035

For more information about how content type IDs are formed, see Content Type IDs.

См. также

Справочные материалы

SPContentTypeId структура

Элементы SPContentTypeId

Пространство имен Microsoft.SharePoint

Другие ресурсы

Content Type IDs

Introduction to Content Types

Site and List Content Types

Base Content Type Hierarchy