🔍 Code Extractor

class ContentTypeEntityData

Maturity: 36

A data class representing SharePoint content type entity metadata, inheriting from ClientValue to provide serialization capabilities for SharePoint API interactions.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/contenttypes/entity_data.py
Lines:
4 - 15
Complexity:
simple

Purpose

ContentTypeEntityData serves as a data transfer object (DTO) for SharePoint content type information. It encapsulates the essential metadata of a content type including its name, description, group classification, and parent content type relationship. This class is used when creating, updating, or transferring content type data between client and SharePoint server, providing a structured way to handle content type entity information in the Office365 Python SDK.

Source Code

class ContentTypeEntityData(ClientValue):
    def __init__(
        self, name=None, description=None, group=None, parent_content_type_id=None
    ):
        self.Name = name
        self.Description = description
        self.Group = group
        self.ParentContentTypeId = parent_content_type_id

    @property
    def entity_type_name(self):
        return "SP.ContentTypeEntityData"

Parameters

Name Type Default Kind
bases ClientValue -

Parameter Details

name: The display name of the content type. This is a human-readable string identifier that appears in SharePoint UI. Can be None if not specified during initialization.

description: A textual description explaining the purpose and usage of the content type. Provides context for users about when to use this content type. Can be None if not specified.

group: The group or category to which this content type belongs. SharePoint uses groups to organize content types in the UI (e.g., 'Document Content Types', 'List Content Types'). Can be None if not specified.

parent_content_type_id: The identifier of the parent content type from which this content type inherits. SharePoint content types support inheritance, and this parameter establishes that relationship. Can be None for base content types or if not specified.

Return Value

Instantiation returns a ContentTypeEntityData object with four instance attributes (Name, Description, Group, ParentContentTypeId) initialized to the provided parameter values or None. The entity_type_name property returns the string 'SP.ContentTypeEntityData', which is used for SharePoint API type identification during serialization.

Class Interface

Methods

__init__(self, name=None, description=None, group=None, parent_content_type_id=None)

Purpose: Initializes a new ContentTypeEntityData instance with content type metadata

Parameters:

  • name: The display name of the content type (optional, defaults to None)
  • description: A description of the content type's purpose (optional, defaults to None)
  • group: The group/category for organizing the content type (optional, defaults to None)
  • parent_content_type_id: The ID of the parent content type for inheritance (optional, defaults to None)

Returns: None (constructor)

@property entity_type_name(self) -> str property

Purpose: Returns the SharePoint entity type name used for API serialization and type identification

Returns: The string 'SP.ContentTypeEntityData' which identifies this object type in SharePoint REST API calls

Attributes

Name Type Description Scope
Name str or None The display name of the content type instance
Description str or None A textual description of the content type's purpose and usage instance
Group str or None The group or category to which this content type belongs for organizational purposes instance
ParentContentTypeId str or None The identifier of the parent content type from which this content type inherits properties instance

Dependencies

  • office365

Required Imports

from office365.runtime.client_value import ClientValue

Usage Example

from office365.runtime.client_value import ClientValue
from office365.sharepoint.contenttypes.entity_data import ContentTypeEntityData

# Create a new content type entity data object
content_type_data = ContentTypeEntityData(
    name="Custom Document",
    description="A custom document content type for project files",
    group="Custom Content Types",
    parent_content_type_id="0x0101"
)

# Access the attributes
print(content_type_data.Name)  # Output: Custom Document
print(content_type_data.Description)  # Output: A custom document content type for project files
print(content_type_data.entity_type_name)  # Output: SP.ContentTypeEntityData

# Create with minimal parameters
minimal_data = ContentTypeEntityData(name="Simple Type")
print(minimal_data.Name)  # Output: Simple Type
print(minimal_data.Description)  # Output: None

Best Practices

  • This is a data class with no complex lifecycle - simply instantiate with the required parameters and use the attributes as needed.
  • All constructor parameters are optional (default to None), allowing flexible instantiation based on available data.
  • The class is immutable in practice - attributes are set during initialization and typically not modified afterward, though Python doesn't enforce this.
  • The entity_type_name property should not be overridden as it's used by the SharePoint API serialization framework to identify the object type.
  • When using with SharePoint APIs, ensure parent_content_type_id follows SharePoint's content type ID format (e.g., '0x0101' for Document content type).
  • This class inherits from ClientValue, which provides serialization capabilities for SharePoint REST API communication - the parent class handles conversion to/from JSON.
  • Typically used as part of larger SharePoint operations rather than standalone - often passed to content type creation or update methods in the Office365 SDK.

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class ContentTypeCreationInformation 80.8% similar

    A data transfer object that encapsulates properties required to create a new SharePoint content type, inheriting from ClientValue for serialization support.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/contenttypes/creation_information.py
  • class ContentType 69.3% similar

    Represents a SharePoint content type, which is a named collection of settings and fields that store metadata for items in a SharePoint list.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/contenttypes/content_type.py
  • class TaxonomyMetadata 68.1% similar

    A client value class representing taxonomy metadata for SharePoint Publishing, specifically storing an anchor ID reference.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/taxonomy/metadata.py
  • class DocumentLibraryInformation 66.9% similar

    A data class that represents metadata and configuration information for a SharePoint document library on a site.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/lists/document_library_information.py
  • class AuditData 66.5% similar

    AuditData is a data class representing audit data in Microsoft SharePoint Tenant Administration, inheriting from ClientValue to provide serialization capabilities.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/tenant/administration/audit/data.py
← Back to Browse