class ContentTypeCreationInformation
A data transfer object that encapsulates properties required to create a new SharePoint content type, inheriting from ClientValue for serialization support.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/contenttypes/creation_information.py
4 - 17
simple
Purpose
This class serves as a parameter container for content type creation operations in SharePoint. It holds the necessary metadata (name, description, group, and content type ID) that defines a new content type. The class inherits from ClientValue, which provides serialization capabilities for transmitting this data to SharePoint services. It's typically used when programmatically creating custom content types in SharePoint sites or lists.
Source Code
class ContentTypeCreationInformation(ClientValue):
def __init__(self, name, description=None, group=None, ct_id=None):
"""Specifies properties that are used as parameters to initialize a new content type.
:param str ct_id: Specifies the ContentTypeId (section 3.2.5.30) of the content type to be constructed.
:param str name: Specifies the name of the content type to be constructed.
:param str description: Specifies the description of the content type to be constructed.
:param str group: Specifies the group of the content type to be constructed.
"""
super(ContentTypeCreationInformation, self).__init__()
self.Name = name
self.Description = description
self.group = group
self.Id = ct_id
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
ClientValue | - |
Parameter Details
name: Required string parameter that specifies the display name of the content type to be created. This is the human-readable identifier that will appear in SharePoint UI.
description: Optional string parameter that provides a detailed description of the content type's purpose and usage. Defaults to None if not provided.
group: Optional string parameter that specifies the group or category under which the content type will be organized in SharePoint. Helps with content type organization and discovery. Defaults to None.
ct_id: Optional string parameter that specifies the ContentTypeId, which is a unique hierarchical identifier for the content type in SharePoint's content type system. If not provided (None), SharePoint may auto-generate one based on parent content type.
Return Value
Instantiation returns a ContentTypeCreationInformation object with four instance attributes (Name, Description, group, Id) populated from the constructor parameters. This object can be serialized and passed to SharePoint API methods that create content types.
Class Interface
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
Name |
str | The display name of the content type to be created | instance |
Description |
str or None | The description text explaining the purpose of the content type | instance |
group |
str or None | The group or category name for organizing the content type | instance |
Id |
str or None | The ContentTypeId, a unique hierarchical identifier in SharePoint's content type system | instance |
Dependencies
office365
Required Imports
from office365.runtime.client_value import ClientValue
Usage Example
from office365.runtime.client_value import ClientValue
# Create a basic content type creation info
ct_info = ContentTypeCreationInformation(
name="Custom Document",
description="A custom document content type for project files",
group="Custom Content Types",
ct_id="0x0101009189AB5D3D2647B580F011DA2F356FB2"
)
# Access the properties
print(ct_info.Name) # Output: Custom Document
print(ct_info.Description) # Output: A custom document content type for project files
print(ct_info.group) # Output: Custom Content Types
print(ct_info.Id) # Output: 0x0101009189AB5D3D2647B580F011DA2F356FB2
# Minimal instantiation with only required parameter
minimal_ct_info = ContentTypeCreationInformation(name="Simple Content Type")
Best Practices
- Always provide a meaningful name parameter as it is required and serves as the primary identifier for users
- Include a description to help users understand the purpose of the content type
- Use the group parameter to organize related content types together for better discoverability
- When specifying ct_id, ensure it follows SharePoint's content type ID format (hexadecimal string starting with 0x)
- This class is immutable after creation - create a new instance if you need different values
- The object is typically passed to SharePoint API methods like ContentTypeCollection.add() rather than used standalone
- Inherits from ClientValue which provides serialization, so the object can be automatically converted to the format expected by SharePoint REST/CSOM APIs
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class ContentTypeEntityData 80.8% similar
-
class WebCreationInformation 79.3% similar
-
class FileCreationInformation 78.3% similar
-
class ListItemCreationInformation 77.3% similar
-
class GroupCreationInformation 75.5% similar