🔍 Code Extractor

class ActivityIdentity

Maturity: 34

ActivityIdentity represents an identity associated with a SharePoint activity, containing client identification and associated user and group identity items.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/activities/identity.py
Lines:
5 - 18
Complexity:
simple

Purpose

This class is a data transfer object (DTO) that encapsulates identity information for SharePoint activities. It inherits from ClientValue, making it suitable for serialization and transmission in SharePoint API operations. The class stores a client ID along with user and group identity information, allowing tracking of who performed specific activities in SharePoint. It's typically used in activity logging, auditing, and tracking scenarios within SharePoint Online operations.

Source Code

class ActivityIdentity(ClientValue):
    def __init__(
        self, client_id=None, group=ActivityIdentityItem(), user=ActivityIdentityItem()
    ):
        """
        :param str client_id:
        """
        self.clientId = client_id
        self.group = group
        self.user = user

    @property
    def entity_type_name(self):
        return "Microsoft.SharePoint.Activities.ActivityIdentity"

Parameters

Name Type Default Kind
bases ClientValue -

Parameter Details

client_id: Optional string identifier for the client associated with this activity. Defaults to None if not provided. This typically represents a unique identifier for the application or service performing the activity.

group: An ActivityIdentityItem instance representing the group identity associated with this activity. Defaults to a new empty ActivityIdentityItem() if not provided. Contains information about the group context in which the activity occurred.

user: An ActivityIdentityItem instance representing the user identity associated with this activity. Defaults to a new empty ActivityIdentityItem() if not provided. Contains information about the user who performed the activity.

Return Value

Instantiation returns an ActivityIdentity object with three attributes: clientId (string or None), group (ActivityIdentityItem), and user (ActivityIdentityItem). The entity_type_name property returns the string 'Microsoft.SharePoint.Activities.ActivityIdentity', which is used for type identification in SharePoint API operations.

Class Interface

Methods

__init__(self, client_id=None, group=ActivityIdentityItem(), user=ActivityIdentityItem())

Purpose: Initializes an ActivityIdentity instance with client identification and associated user and group identity items

Parameters:

  • client_id: Optional string identifier for the client (defaults to None)
  • group: ActivityIdentityItem instance for group identity (defaults to new ActivityIdentityItem())
  • user: ActivityIdentityItem instance for user identity (defaults to new ActivityIdentityItem())

Returns: None (constructor)

@property entity_type_name(self) -> str property

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

Returns: String value 'Microsoft.SharePoint.Activities.ActivityIdentity'

Attributes

Name Type Description Scope
clientId str or None Stores the client identifier associated with this activity identity instance
group ActivityIdentityItem Stores the group identity information associated with this activity instance
user ActivityIdentityItem Stores the user identity information associated with this activity instance

Dependencies

  • office365

Required Imports

from office365.runtime.client_value import ClientValue
from office365.sharepoint.activities.identity_item import ActivityIdentityItem

Usage Example

from office365.runtime.client_value import ClientValue
from office365.sharepoint.activities.identity_item import ActivityIdentityItem
from office365.sharepoint.activities.activity_identity import ActivityIdentity

# Create identity items for user and group
user_identity = ActivityIdentityItem()
group_identity = ActivityIdentityItem()

# Create an ActivityIdentity with all parameters
activity_identity = ActivityIdentity(
    client_id='client-123',
    group=group_identity,
    user=user_identity
)

# Create with defaults
default_identity = ActivityIdentity()

# Access attributes
print(activity_identity.clientId)  # 'client-123'
print(activity_identity.entity_type_name)  # 'Microsoft.SharePoint.Activities.ActivityIdentity'

# Modify attributes
activity_identity.clientId = 'new-client-456'

Best Practices

  • Always provide meaningful client_id values when tracking specific client applications or services
  • Use properly initialized ActivityIdentityItem instances for user and group parameters rather than None to avoid potential attribute errors
  • This class is immutable after creation in typical usage - create new instances rather than modifying existing ones for thread safety
  • The entity_type_name property should not be overridden as it's used for SharePoint API type identification
  • This class inherits from ClientValue, which means it's designed for serialization - ensure all attributes remain JSON-serializable
  • When used in SharePoint API calls, the object will be automatically serialized using the entity_type_name for proper type handling

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class ActivityIdentityItem 91.4% similar

    A data class representing an activity identity item in SharePoint Activities, inheriting from ClientValue to provide serialization capabilities for SharePoint API interactions.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/activities/identity_item.py
  • class ActivityClientRequest 71.6% similar

    A client value class representing an ActivityClientRequest entity in Microsoft SharePoint Activities API, inheriting from ClientValue base class.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/activities/client_request.py
  • class Identity_v1 71.2% similar

    Identity is a client value class representing a Microsoft SharePoint Comments identity entity, inheriting from ClientValue base class.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/comments/client/identity.py
  • class Identity 69.9% similar

    The Identity class represents an identity of an actor (user, device, or application) in the Microsoft Office 365 API, storing display name and unique identifier information.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/permissions/identity.py
  • class ActivityClientResponse 69.8% similar

    A client value class representing an ActivityClientResponse entity from Microsoft SharePoint Activities API.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/activities/client_response.py
← Back to Browse