Skip to content

Create an utils class for the Planner commands #3268

@plamber

Description

@plamber

Description

Create a planner util class. It needs to contain the following functions:

Function Description
getPlanById(id: string): Promise<PlannerPlan> retrieves a unique plan, and rejects with an error if the Plan can't be found.
getPlanByName(name: string, groupId: string): Promise<PlannerPlan> retrieves plan by name and groupId, shows list of ids if multiple plans with the same name are found (Yes, this is possible from the Planner UI, though unlogical), reject with an error if the Plan can't be found
getPlansByGroupId(groupId: string): Promise<PlannerPlan[]> retrieves plans by group id

The functions should be implemented in all commands that should use them.

Background

We implemented a lot of planner-based commands lately. Most of the time, commands share duplicate code.
We should start introducing a utils class as we did with spo: https://github.com/pnp/cli-microsoft365/blob/b46b8928d315fabe26579d93b73d4ea843682106/src/utils/spo.ts

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions