🔍 Code Extractor

class AssignedPlan

Maturity: 50

Represents an assigned plan (license/service plan) associated with a user or organization entity in Microsoft Graph API, containing information about service assignments, capabilities, and status.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/licenses/assigned_plan.py
Lines:
4 - 31
Complexity:
simple

Purpose

This class models the assignedPlan resource from Microsoft Graph API, which represents a service plan assignment to a user or organization. It stores metadata about when a plan was assigned, its current capability status, the service name, and the service plan identifier. This is used to track licensing and service subscriptions in Microsoft 365 environments.

Source Code

class AssignedPlan(ClientValue):
    """
    The assignedPlans property of both the user entity and the organization entity is a collection of assignedPlan.
    """

    def __init__(
        self,
        assigned_datetime=None,
        capability_status=None,
        service=None,
        service_plan_id=None,
    ):
        """
        :param datetime.datetime assigned_datetime: The date and time at which the plan was assigned.
        :param str capability_status: Condition of the capability assignment.
            The possible values are Enabled, Warning, Suspended, Deleted, LockedOut.
            See a detailed description of each value.
        :param str service: The name of the service; for example, exchange.
        :param str service_plan_id: A GUID that identifies the service plan. For a complete list of GUIDs and their
            equivalent friendly service names, see Product names and service plan identifiers for licensing.
        """
        self.assignedDateTime = assigned_datetime
        self.capabilityStatus = capability_status
        self.service = service
        self.servicePlanId = service_plan_id

    def __repr__(self):
        return self.service

Parameters

Name Type Default Kind
bases ClientValue -

Parameter Details

assigned_datetime: A datetime object representing when the plan was assigned to the user or organization. Can be None if the assignment date is not available or not yet set.

capability_status: A string indicating the current status of the capability assignment. Valid values are: 'Enabled' (active and usable), 'Warning' (issues detected), 'Suspended' (temporarily disabled), 'Deleted' (removed), 'LockedOut' (access blocked). Can be None if status is unknown.

service: A string containing the name of the Microsoft service associated with this plan (e.g., 'exchange', 'SharePoint', 'Teams'). Can be None if service name is not specified.

service_plan_id: A GUID string that uniquely identifies the service plan. This corresponds to Microsoft's product names and service plan identifiers for licensing. Can be None if the plan ID is not available.

Return Value

Instantiation returns an AssignedPlan object that inherits from ClientValue. The object contains four instance attributes (assignedDateTime, capabilityStatus, service, servicePlanId) that store the plan assignment details. The __repr__ method returns the service name as a string representation of the object.

Class Interface

Methods

__init__(self, assigned_datetime=None, capability_status=None, service=None, service_plan_id=None)

Purpose: Initializes an AssignedPlan instance with service plan assignment details

Parameters:

  • assigned_datetime: datetime.datetime object representing when the plan was assigned
  • capability_status: String indicating the status of the capability (Enabled, Warning, Suspended, Deleted, LockedOut)
  • service: String name of the Microsoft service (e.g., 'exchange')
  • service_plan_id: GUID string identifying the service plan

Returns: None (constructor)

__repr__(self) -> str

Purpose: Returns a string representation of the AssignedPlan object using the service name

Returns: String containing the service name, or None if service is not set

Attributes

Name Type Description Scope
assignedDateTime datetime.datetime or None The date and time when the plan was assigned to the user or organization instance
capabilityStatus str or None The current status of the capability assignment (Enabled, Warning, Suspended, Deleted, LockedOut) instance
service str or None The name of the Microsoft service associated with this plan (e.g., 'exchange', 'SharePoint') instance
servicePlanId str or None A GUID that uniquely identifies the service plan in Microsoft's licensing system instance

Dependencies

  • office365

Required Imports

from office365.runtime.client_value import ClientValue

Usage Example

from office365.runtime.client_value import ClientValue
from datetime import datetime

# Create an assigned plan instance
plan = AssignedPlan(
    assigned_datetime=datetime(2023, 1, 15, 10, 30, 0),
    capability_status='Enabled',
    service='exchange',
    service_plan_id='efb87545-963c-4e0d-99df-69c6916d9eb0'
)

# Access attributes
print(plan.service)  # Output: exchange
print(plan.capabilityStatus)  # Output: Enabled
print(plan)  # Output: exchange (uses __repr__)

# Create with minimal parameters
minimal_plan = AssignedPlan(service='SharePoint')
print(minimal_plan.assignedDateTime)  # Output: None

Best Practices

  • All constructor parameters are optional, allowing flexible instantiation based on available data from the API
  • The class uses camelCase for attribute names (assignedDateTime, capabilityStatus, servicePlanId) to match Microsoft Graph API naming conventions
  • When creating instances, ensure capability_status uses one of the valid values: 'Enabled', 'Warning', 'Suspended', 'Deleted', or 'LockedOut'
  • The service_plan_id should be a valid GUID string corresponding to Microsoft's official service plan identifiers
  • This class is typically instantiated by the Office 365 SDK when deserializing API responses, rather than manually by developers
  • The __repr__ method returns only the service name, which may not be unique if multiple plans for the same service exist
  • Inherits from ClientValue, which likely provides serialization/deserialization capabilities for API communication
  • This is an immutable data container - attributes are set during initialization and typically not modified afterward

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class AssignedLicense 75.4% similar

    Represents a license assigned to a user in Microsoft 365/Office 365, containing the SKU identifier and any disabled plans associated with that license.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/licenses/assigned_license.py
  • class LicenseAssignmentState 69.3% similar

    Represents the license assignment state for a user in Microsoft 365/Office 365, tracking how licenses are assigned (directly or via group) and their current status.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/licenses/assignment_state.py
  • class ServicePlanInfo 64.1% similar

    A data class representing information about a service plan associated with a subscribed SKU in Microsoft 365/Office 365 services.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/licenses/service_plan_info.py
  • class PlannerPlanCollection 63.3% similar

    A collection class for managing Microsoft Planner Plan entities, providing methods to create and manage multiple PlannerPlan objects within a Microsoft Graph API context.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/planner/plans/collection.py
  • class PlannerPlan 63.1% similar

    The plannerPlan resource represents a plan in Microsoft 365. A plan can be owned by a group and contains a collection of plannerTasks. It can also have a collection of plannerBuckets. Each plan object has a details object that can contain more information about the plan. For more information about the relationships between groups, plans, and tasks, see Planner.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/planner/plans/plan.py
← Back to Browse