🔍 Code Extractor

class GetCommentFacet

Maturity: 38

A data class representing metadata facets for SharePoint activity comments, including information about assignees, participants, parent comments, and reply relationships.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/activities/facets/get_comment.py
Lines:
6 - 35
Complexity:
simple

Purpose

GetCommentFacet is a value object that encapsulates comment-related metadata in SharePoint Activities. It inherits from ClientValue and is used to represent structured data about comments, including their relationships (parent-child for replies), associated users (assignees and participants), and identification information. This class is typically used when retrieving or working with comment data from SharePoint's activity feed or commenting system.

Source Code

class GetCommentFacet(ClientValue):
    """"""

    def __init__(
        self,
        assignees=None,
        comment_id=None,
        is_reply=None,
        parent_author=ActivityIdentity(),
        parent_comment_id=None,
        participants=None,
    ):
        """
        :param list[ActivityIdentity] assignees:
        :param str comment_id:
        :param bool is_reply:
        :param ActivityIdentity parent_author: Gets or sets the parent author.
        :param str parent_comment_id:
        :param list[ActivityIdentity] participants:
        """
        self.assignees = ClientValueCollection(ActivityIdentity, assignees)
        self.commentId = comment_id
        self.isReply = is_reply
        self.parentAuthor = parent_author
        self.parentCommentId = parent_comment_id
        self.participants = ClientValueCollection(ActivityIdentity, participants)

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

Parameters

Name Type Default Kind
bases ClientValue -

Parameter Details

assignees: A list of ActivityIdentity objects representing users assigned to this comment. Can be None if no assignees exist. Used for task-related comments or comments requiring action from specific users.

comment_id: A string identifier uniquely identifying this comment within the SharePoint system. Can be None if not yet assigned or when creating a new comment.

is_reply: A boolean flag indicating whether this comment is a reply to another comment (True) or a top-level comment (False). Can be None if the reply status is unknown or not applicable.

parent_author: An ActivityIdentity object representing the author of the parent comment when this comment is a reply. Defaults to an empty ActivityIdentity() instance. Only relevant when is_reply is True.

parent_comment_id: A string identifier of the parent comment when this comment is a reply. Can be None for top-level comments or when parent information is not available.

participants: A list of ActivityIdentity objects representing all users who have participated in the comment thread. Can be None if participant tracking is not enabled or no participants exist.

Return Value

Instantiation returns a GetCommentFacet object with all provided parameters stored as instance attributes. The entity_type_name property returns the string 'Microsoft.SharePoint.Activities.GetCommentFacet', which is used for serialization and type identification in SharePoint API communications.

Class Interface

Methods

__init__(self, assignees=None, comment_id=None, is_reply=None, parent_author=ActivityIdentity(), parent_comment_id=None, participants=None)

Purpose: Initializes a new GetCommentFacet instance with comment metadata including assignees, identification, reply status, and participant information

Parameters:

  • assignees: List of ActivityIdentity objects representing users assigned to the comment
  • comment_id: String identifier for the comment
  • is_reply: Boolean indicating if this is a reply to another comment
  • parent_author: ActivityIdentity object representing the parent comment's author
  • parent_comment_id: String identifier of the parent comment
  • participants: List of ActivityIdentity objects representing all participants in the comment thread

Returns: A new GetCommentFacet instance with all attributes initialized

@property entity_type_name(self) -> str property

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

Returns: The string 'Microsoft.SharePoint.Activities.GetCommentFacet' identifying this entity type in SharePoint

Attributes

Name Type Description Scope
assignees ClientValueCollection[ActivityIdentity] Collection of ActivityIdentity objects representing users assigned to this comment instance
commentId str Unique identifier for this comment in the SharePoint system instance
isReply bool Flag indicating whether this comment is a reply to another comment instance
parentAuthor ActivityIdentity ActivityIdentity object representing the author of the parent comment when this is a reply instance
parentCommentId str Identifier of the parent comment when this comment is a reply instance
participants ClientValueCollection[ActivityIdentity] Collection of ActivityIdentity objects representing all users who have participated in the comment thread instance

Dependencies

  • office365

Required Imports

from office365.runtime.client_value import ClientValue
from office365.runtime.client_value_collection import ClientValueCollection
from office365.sharepoint.activities.identity import ActivityIdentity

Usage Example

from office365.sharepoint.activities.identity import ActivityIdentity
from office365.sharepoint.activities.get_comment_facet import GetCommentFacet

# Create activity identities for users
author = ActivityIdentity()
author.id = 'user1@example.com'

assignee1 = ActivityIdentity()
assignee1.id = 'user2@example.com'

participant1 = ActivityIdentity()
participant1.id = 'user3@example.com'

# Create a top-level comment facet
top_level_comment = GetCommentFacet(
    comment_id='comment-123',
    is_reply=False,
    assignees=[assignee1],
    participants=[author, participant1]
)

# Create a reply comment facet
reply_comment = GetCommentFacet(
    comment_id='comment-456',
    is_reply=True,
    parent_comment_id='comment-123',
    parent_author=author,
    participants=[author, participant1]
)

# Access the entity type name for serialization
entity_type = reply_comment.entity_type_name
print(entity_type)  # Output: Microsoft.SharePoint.Activities.GetCommentFacet

# Access comment properties
print(f'Is reply: {reply_comment.isReply}')
print(f'Parent comment: {reply_comment.parentCommentId}')
print(f'Number of participants: {len(reply_comment.participants)}')

Best Practices

  • Always provide a valid comment_id when working with existing comments to ensure proper identification
  • Set is_reply to True and provide parent_comment_id and parent_author when creating reply comments to maintain proper comment hierarchy
  • Use ActivityIdentity objects consistently for all user-related fields (assignees, participants, parent_author) to ensure proper serialization
  • The assignees and participants parameters accept lists but are automatically converted to ClientValueCollection internally, so pass regular Python lists during instantiation
  • This is an immutable value object - create new instances rather than modifying existing ones when comment metadata changes
  • The entity_type_name property is used internally by the Office365 library for serialization; do not override it
  • When is_reply is False, parent_comment_id and parent_author should typically be None or empty to avoid confusion
  • This class inherits from ClientValue, which provides serialization capabilities for SharePoint API communication

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class SharingFacet 75.5% similar

    A data class representing sharing information for SharePoint activities, including recipients and sharing type.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/activities/facets/sharing.py
  • class CreateFacet 75.1% similar

    CreateFacet is a client value class representing a Microsoft SharePoint Activities CreateFacet entity, used for SharePoint activity tracking and operations.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/activities/facets/create.py
  • class EditFacet 74.7% similar

    EditFacet is a client-side value object representing a Microsoft SharePoint Activities EditFacet entity, used for tracking or representing edit-related activity facets in SharePoint.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/activities/facets/edit.py
  • class RenameFacet 72.3% similar

    RenameFacet is a client value class that represents metadata about a rename operation in SharePoint Activities, storing the old name of an entity being renamed.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/activities/facets/rename.py
  • class DeleteFacet 72.1% similar

    A client value class representing a delete facet operation in SharePoint Activities, used to encapsulate deletion metadata.

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