class PlannerGroup
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.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/planner/group.py
5 - 23
simple
Purpose
This class serves as a wrapper entity for accessing Microsoft Planner functionality within the context of a Microsoft 365 group. It inherits from Entity and provides a property-based interface to retrieve PlannerPlanCollection objects. The class acts as an entry point for group-related planner operations, though it doesn't maintain any usable properties of its own beyond the inherited Entity properties.
Source Code
class PlannerGroup(Entity):
"""
The plannerGroup resource provides access to Planner resources for a group.
It doesn't contain any usable properties.
"""
@property
def plans(self):
"""
Returns the plannerPlans owned by the group.
"""
from office365.planner.plans.collection import PlannerPlanCollection
return self.properties.get(
"plans",
PlannerPlanCollection(
self.context, ResourcePath("plans", self.resource_path)
),
)
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
Entity | - |
Parameter Details
context: The client context object required for making API calls to Microsoft 365 services. This is inherited from the Entity base class and is used to authenticate and communicate with the Planner API.
resource_path: The resource path identifying the specific group in the Microsoft 365 environment. This is inherited from Entity and used to construct child resource paths for accessing plans.
Return Value
Instantiation returns a PlannerGroup object that provides access to group planner resources. The main method 'plans' returns a PlannerPlanCollection object containing all planner plans owned by the group. This collection can be used to query, create, or manage plans associated with the group.
Class Interface
Methods
@property plans(self) -> PlannerPlanCollection
property
Purpose: Returns the collection of planner plans owned by the group. Uses lazy initialization to create the collection only when first accessed.
Returns: PlannerPlanCollection object containing all plans associated with the group. The collection provides methods to query, create, and manage plans.
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
context |
ClientContext | The client context used for API communication with Microsoft 365 services. Inherited from Entity base class. | instance |
resource_path |
ResourcePath | The resource path identifying this group in the Microsoft 365 environment. Inherited from Entity base class. | instance |
properties |
dict | Dictionary storing cached properties and collections, including the plans collection. Inherited from Entity base class. | instance |
Dependencies
office365.entityoffice365.runtime.paths.resource_pathoffice365.planner.plans.collection
Required Imports
from office365.entity import Entity
from office365.runtime.paths.resource_path import ResourcePath
Conditional/Optional Imports
These imports are only needed under specific conditions:
from office365.planner.plans.collection import PlannerPlanCollection
Condition: only when accessing the 'plans' property for the first time
Required (conditional)Usage Example
from office365.planner.groups.group import PlannerGroup
from office365.runtime.client_context import ClientContext
from office365.runtime.paths.resource_path import ResourcePath
# Assuming you have a configured client context
ctx = ClientContext.connect_with_credentials(tenant_url, credentials)
# Create a PlannerGroup instance for a specific group
group_id = 'group-guid-here'
resource_path = ResourcePath(group_id)
planner_group = PlannerGroup(ctx, resource_path)
# Access the plans collection for this group
plans_collection = planner_group.plans
# Load and iterate through plans
plans_collection.get().execute_query()
for plan in plans_collection:
print(f'Plan: {plan.title}')
Best Practices
- Always ensure the client context is properly authenticated before instantiating PlannerGroup
- The 'plans' property uses lazy loading - the PlannerPlanCollection is only created when first accessed
- The class caches the plans collection in the properties dictionary to avoid recreating it on subsequent accesses
- This class should be instantiated through the parent Entity framework rather than directly, typically accessed via a Group object's planner property
- The class inherits from Entity, so all Entity methods and properties are available (e.g., get(), update(), delete())
- Remember to call execute_query() on the context after operations to actually execute the API calls
- The resource path should point to a valid Microsoft 365 group that has Planner enabled
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class PlannerUser 81.1% similar
-
class Planner 80.9% similar
-
class PlannerPlanCollection 77.6% similar
-
class PlannerPlan 74.0% similar
-
class PlannerTask 72.3% similar