🔍 Code Extractor

class Session

Maturity: 48

Represents a user-user communication or a user-meeting communication session, such as a conference call, in the Office 365 communications system.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/communications/callrecords/session.py
Lines:
7 - 20
Complexity:
moderate

Purpose

This class models a communication session within Office 365 call records. It extends the Entity base class and provides access to segments that make up the session. A session can represent direct user-to-user communication or multi-party conference calls. The class serves as a container for managing and accessing the individual segments that comprise a complete communication session.

Source Code

class Session(Entity):
    """Represents a user-user communication or a user-meeting communication in the case of a conference call."""

    @property
    def segments(self):
        """
        The list of segments involved in the session.
        """
        return self.properties.get(
            "segments",
            EntityCollection(
                self.context, Segment, ResourcePath("segments", self.resource_path)
            ),
        )

Parameters

Name Type Default Kind
bases Entity -

Parameter Details

context: The execution context required by the parent Entity class, typically containing authentication and service connection information for Office 365 API calls

resource_path: The API resource path identifying this specific session entity within the Office 365 service hierarchy

Return Value

Instantiation returns a Session object that represents a communication session. The segments property returns an EntityCollection containing Segment objects that represent the individual parts of the session.

Class Interface

Methods

@property segments(self) -> EntityCollection property

Purpose: Provides access to the collection of segments that make up this communication session

Returns: An EntityCollection containing Segment objects representing the individual parts of the session. If not previously loaded, creates a new EntityCollection with the appropriate resource path.

Attributes

Name Type Description Scope
properties dict Inherited from Entity class. Stores the entity's properties including the segments collection. Used internally for property management and lazy loading. instance
context ClientContext Inherited from Entity class. The execution context containing authentication and service connection information for API operations. instance
resource_path ResourcePath Inherited from Entity class. The API resource path identifying this session entity within the Office 365 service hierarchy. instance

Dependencies

  • office365.communications.callrecords.segment
  • office365.entity
  • office365.entity_collection
  • office365.runtime.paths.resource_path

Required Imports

from office365.communications.callrecords.session import Session
from office365.communications.callrecords.segment import Segment
from office365.entity import Entity
from office365.entity_collection import EntityCollection
from office365.runtime.paths.resource_path import ResourcePath

Usage Example

# Assuming you have an authenticated Office 365 context
from office365.communications.callrecords.session import Session
from office365.runtime.client_context import ClientContext

# Create context (authentication details omitted for brevity)
context = ClientContext(site_url)

# Session is typically retrieved from a call record, not instantiated directly
# Example: accessing session from a call record
call_record = context.call_records.get_by_id('call_record_id')
sessions = call_record.sessions

# Access segments within a session
for session in sessions:
    segments = session.segments
    context.load(segments)
    context.execute_query()
    
    for segment in segments:
        print(f'Segment ID: {segment.id}')
        print(f'Start time: {segment.start_date_time}')

Best Practices

  • Session objects are typically retrieved from call records rather than instantiated directly
  • Always load the segments collection using context.load() and context.execute_query() before accessing segment data
  • The segments property uses lazy loading - it creates the EntityCollection only when first accessed
  • Ensure proper authentication context is established before working with Session objects
  • Session inherits from Entity, so all Entity methods and properties are available
  • The properties dictionary is managed by the parent Entity class and should not be modified directly
  • Use the segments property to access related Segment entities rather than accessing the properties dictionary directly

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class Segment 75.3% similar

    Represents a portion of a User-User or User-Meeting communication segment in Microsoft Graph call records, typically corresponding to one segment per VOIP session or multiple segments for PSTN calls.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/communications/callrecords/segment.py
  • class CallRecord 62.7% similar

    Represents a single peer-to-peer call or a group call between multiple participants in Microsoft 365, sometimes referred to as an online meeting.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/communications/callrecords/call_record.py
  • class CloudCommunications 59.7% similar

    CloudCommunications is a class that provides access to Microsoft Graph API cloud communications resources including calls, call records, online meetings, and user presence information.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/communications/cloud_communications.py
  • class DirectorySession 56.5% similar

    DirectorySession is a SharePoint directory service class that provides access to user information and graph data within a SharePoint context.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/directory/session.py
  • class UploadSessionQuery 55.2% similar

    A specialized query class for creating upload sessions in Office 365 services, extending ServiceOperationQuery to handle file upload session initialization.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/runtime/queries/upload_session.py
← Back to Browse