🔍 Code Extractor

class Planner

Maturity: 49

The Planner class is a singleton entry point for accessing Microsoft Planner resources, providing access to buckets, tasks, and plans assigned to a user.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/planner/planner.py
Lines:
9 - 46
Complexity:
moderate

Purpose

This class serves as the main interface for interacting with Microsoft Planner data through the Microsoft Graph API. It inherits from Entity and provides lazy-loaded collections of PlannerBucket, PlannerTask, and PlannerPlan objects. As a singleton resource, it represents the user's planner context and doesn't contain direct properties but provides access to related collections through property accessors.

Source Code

class Planner(Entity):
    """
    The planner resource is the entry point for the Planner object model.
    It returns a singleton planner resource. It doesn't contain any usable properties.
    """

    @property
    def buckets(self):
        # type: () -> EntityCollection[PlannerBucket]
        """Returns the plannerBuckets assigned to the user."""
        return self.properties.get(
            "buckets",
            EntityCollection(
                self.context, PlannerBucket, ResourcePath("buckets", self.resource_path)
            ),
        )

    @property
    def tasks(self):
        # type: () -> EntityCollection[PlannerTask]
        """Returns the plannerTasks assigned to the user."""
        return self.properties.get(
            "tasks",
            EntityCollection(
                self.context, PlannerTask, ResourcePath("tasks", self.resource_path)
            ),
        )

    @property
    def plans(self):
        # type: () -> PlannerPlanCollection
        """Returns the plannerTasks assigned to the user."""
        return self.properties.get(
            "plans",
            PlannerPlanCollection(
                self.context, ResourcePath("plans", self.resource_path)
            ),
        )

Parameters

Name Type Default Kind
bases Entity -

Parameter Details

context: Inherited from Entity base class. The context object that manages API communication and authentication for Microsoft Graph API requests.

resource_path: Inherited from Entity base class. The ResourcePath object that defines the API endpoint path for this planner resource.

Return Value

Instantiation returns a Planner object that acts as a singleton entry point. The class properties return EntityCollection objects for buckets and tasks, and a PlannerPlanCollection for plans. These collections are lazily initialized and cached in the properties dictionary.

Class Interface

Methods

@property buckets() -> EntityCollection[PlannerBucket] property

Purpose: Returns a collection of PlannerBucket objects assigned to the user

Returns: EntityCollection[PlannerBucket] - A collection object containing all planner buckets accessible to the user. The collection is lazily loaded and cached.

@property tasks() -> EntityCollection[PlannerTask] property

Purpose: Returns a collection of PlannerTask objects assigned to the user

Returns: EntityCollection[PlannerTask] - A collection object containing all planner tasks accessible to the user. The collection is lazily loaded and cached.

@property plans() -> PlannerPlanCollection property

Purpose: Returns a specialized collection of PlannerPlan objects assigned to the user

Returns: PlannerPlanCollection - A specialized collection object containing all planner plans accessible to the user. The collection is lazily loaded and cached.

Attributes

Name Type Description Scope
context ClientContext Inherited from Entity. The context object managing API communication, authentication, and request execution for Microsoft Graph API instance
resource_path ResourcePath Inherited from Entity. The path object defining the API endpoint location for this planner resource instance
properties dict Inherited from Entity. Dictionary storing cached property values including the lazily-loaded collections for buckets, tasks, and plans instance

Dependencies

  • office365

Required Imports

from office365.entity import Entity
from office365.entity_collection import EntityCollection
from office365.planner.buckets.bucket import PlannerBucket
from office365.planner.plans.collection import PlannerPlanCollection
from office365.planner.tasks.task import PlannerTask
from office365.runtime.paths.resource_path import ResourcePath

Usage Example

# Assuming you have a configured context object from office365 library
from office365.planner.planner import Planner
from office365.graph_client import GraphClient

# Initialize Graph client with credentials
client = GraphClient(lambda: ('your_token',))

# Get the planner singleton
planner = client.planner

# Access user's planner buckets
buckets = planner.buckets
for bucket in buckets:
    print(bucket.name)

# Access user's planner tasks
tasks = planner.tasks
for task in tasks:
    print(task.title)

# Access user's planner plans
plans = planner.plans
for plan in plans:
    print(plan.title)

Best Practices

  • The Planner class is designed as a singleton resource - typically accessed through a GraphClient instance rather than instantiated directly
  • Properties (buckets, tasks, plans) are lazily loaded and cached, so repeated access doesn't trigger multiple API calls
  • Always ensure proper authentication context is established before accessing planner resources
  • The collections returned by properties support standard iteration and querying patterns from the office365 library
  • This class doesn't contain direct data properties - all data access is through the collection properties
  • Handle API rate limits and network errors when iterating through collections
  • The resource_path and context are inherited from Entity and should be properly initialized by the parent framework

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class PlannerUser 82.9% similar

    PlannerUser is a resource class that provides access to Microsoft Planner resources (plans and tasks) associated with a specific user.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/planner/user.py
  • class PlannerGroup 80.9% similar

    PlannerGroup is a class that provides access to Microsoft Planner resources associated with a group, specifically enabling retrieval of planner plans owned by the group.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/planner/group.py
  • class PlannerPlan 75.4% 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
  • class PlannerTask 74.8% similar

    Represents a Microsoft 365 Planner task entity with properties for title and detailed task information.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/planner/tasks/task.py
  • class PlannerBucket 74.5% similar

    Represents a bucket (custom column) for organizing tasks within a Microsoft 365 Planner plan, providing access to the collection of tasks contained in the bucket.

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