🔍 Code Extractor

class SharingFacet

Maturity: 31

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

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

Purpose

SharingFacet is a value object that encapsulates sharing-related metadata for SharePoint activities. It stores information about who an item is shared with (recipients) and the type of sharing being performed. This class inherits from ClientValue, making it suitable for serialization and transmission in SharePoint API operations. It's typically used as part of activity tracking or audit logging to record sharing events.

Source Code

class SharingFacet(ClientValue):
    def __init__(self, recipients=None, sharing_type=None):
        """
        :param list[ActivityIdentity] recipients:
        :param str sharing_type:
        """
        self.recipients = ClientValueCollection(ActivityIdentity, recipients)
        self.sharingType = sharing_type

Parameters

Name Type Default Kind
bases ClientValue -

Parameter Details

recipients: A list of ActivityIdentity objects representing the users or entities with whom content is being shared. Can be None if no recipients are specified. Each ActivityIdentity contains information about a user, group, or other entity involved in the sharing activity.

sharing_type: A string indicating the type of sharing operation being performed (e.g., 'direct', 'link', 'anonymous'). Can be None if the sharing type is not specified or unknown. The exact values depend on SharePoint's sharing model.

Return Value

Instantiation returns a SharingFacet object with two attributes: 'recipients' (a ClientValueCollection of ActivityIdentity objects) and 'sharingType' (a string). The object represents a complete sharing context that can be used in SharePoint activity operations.

Class Interface

Methods

__init__(recipients=None, sharing_type=None)

Purpose: Initializes a SharingFacet instance with optional recipients and sharing type information

Parameters:

  • recipients: Optional list of ActivityIdentity objects representing sharing recipients
  • sharing_type: Optional string indicating the type of sharing operation

Returns: None (constructor)

Attributes

Name Type Description Scope
recipients ClientValueCollection[ActivityIdentity] A collection of ActivityIdentity objects representing the users or entities with whom content is shared. Managed as a ClientValueCollection for proper serialization in SharePoint API calls. instance
sharingType str A string value indicating the type of sharing operation (e.g., 'direct', 'link', 'anonymous'). Uses camelCase to match SharePoint API naming conventions. 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.sharing_facet import SharingFacet

# Create activity identities for recipients
recipient1 = ActivityIdentity()
recipient1.id = 'user1@example.com'
recipient1.displayName = 'John Doe'

recipient2 = ActivityIdentity()
recipient2.id = 'user2@example.com'
recipient2.displayName = 'Jane Smith'

# Create a SharingFacet with recipients and sharing type
sharing_facet = SharingFacet(
    recipients=[recipient1, recipient2],
    sharing_type='direct'
)

# Access the sharing information
print(f'Sharing type: {sharing_facet.sharingType}')
print(f'Number of recipients: {len(sharing_facet.recipients)}')

# Iterate through recipients
for recipient in sharing_facet.recipients:
    print(f'Recipient: {recipient.displayName}')

Best Practices

  • Always initialize with appropriate recipients list when tracking sharing activities to maintain accurate audit trails
  • Use meaningful sharing_type values that align with SharePoint's sharing model (e.g., 'direct', 'link', 'anonymous')
  • The recipients parameter accepts None or a list; the ClientValueCollection will handle the conversion appropriately
  • This is a value object (inherits from ClientValue), so it's immutable in concept and should represent a snapshot of sharing state
  • When used in SharePoint API operations, ensure the ActivityIdentity objects in recipients are properly populated with valid user information
  • This class is typically used as part of larger activity or audit objects rather than standalone
  • The sharingType attribute uses camelCase to match SharePoint API conventions, while the constructor parameter uses snake_case following Python conventions

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class CreateFacet 78.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 GetCommentFacet 75.5% similar

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

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/activities/facets/get_comment.py
  • class EditFacet 75.4% 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 InDocFacet 74.4% similar

    InDocFacet is a client-side value object representing a Microsoft SharePoint Activities InDocFacet entity, inheriting from ClientValue base class.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/activities/facets/in_doc.py
  • class RenameFacet 74.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
← Back to Browse