class ComponentContextInfo
A wrapper class for SharePoint's ContextInfo object, specifically designed for internal use with client-side components.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/clientsidecomponent/component_context_info.py
4 - 16
simple
Purpose
ComponentContextInfo serves as an Entity wrapper for Microsoft SharePoint's internal ClientSideComponent.ComponentContextInfo. It provides access to serialized context data for SharePoint client-side components. This class is marked as reserved for internal use only and is part of the Office365 SharePoint API implementation. It inherits from the Entity base class and provides property-based access to serialized component context information.
Source Code
class ComponentContextInfo(Entity):
"""This class functions as a wrapper of the ContextInfo object. Reserved for internal use only."""
@property
def serialized_data(self):
"""
:rtype: str
"""
return self.properties.get("SerializedData", None)
@property
def entity_type_name(self):
return "Microsoft.SharePoint.Internal.ClientSideComponent.ComponentContextInfo"
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
Entity | - |
Parameter Details
bases: Inherits from Entity class, which provides the base functionality for SharePoint entities including property management and entity type handling
Return Value
Instantiation returns a ComponentContextInfo object that wraps SharePoint context information. The serialized_data property returns a string containing serialized context data, or None if not available. The entity_type_name property returns the fully qualified type name string for SharePoint's internal component context.
Class Interface
Methods
@property serialized_data(self) -> str
property
Purpose: Retrieves the serialized context data from the component's properties
Returns: A string containing serialized context data, or None if the 'SerializedData' property is not set
@property entity_type_name(self) -> str
property
Purpose: Returns the fully qualified entity type name for SharePoint's internal component context
Returns: The string 'Microsoft.SharePoint.Internal.ClientSideComponent.ComponentContextInfo' representing the entity type
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
properties |
dict | Inherited from Entity base class, stores the component's properties including 'SerializedData'. Accessed through property methods. | instance |
Dependencies
office365
Required Imports
from office365.sharepoint.entity import Entity
from office365.sharepoint.client_side_component.component_context_info import ComponentContextInfo
Usage Example
# Note: This class is for internal use only
# Typical usage would be through SharePoint API calls
from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.client_side_component.component_context_info import ComponentContextInfo
# Assuming you have a ClientContext instance
ctx = ClientContext(site_url).with_credentials(credentials)
# ComponentContextInfo would typically be instantiated internally
# by the SharePoint API when retrieving component context
component_context = ComponentContextInfo(ctx)
# Access serialized data
if component_context.serialized_data:
data = component_context.serialized_data
print(f"Serialized context: {data}")
# Get entity type name
type_name = component_context.entity_type_name
print(f"Entity type: {type_name}")
Best Practices
- This class is marked as 'Reserved for internal use only' - avoid direct instantiation in application code
- Use through official SharePoint API methods rather than creating instances directly
- The class inherits from Entity, so it follows the Entity lifecycle and property management patterns
- Access properties through the provided property decorators rather than direct property dictionary access
- The serialized_data property may return None, so always check for None before using the value
- This class is read-only in nature - it wraps existing context information rather than creating new context
- Ensure proper SharePoint authentication and context is established before working with component context objects
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class ClientContext 67.0% similar
-
class SharePointHomeServiceContext 65.4% similar
-
class SPClientSideComponentIdentifier 63.3% similar
-
class ChannelInfo 62.8% similar
-
class RequestUserContext 61.4% similar