Skip to content

Create an utils class for the Microsoft 365 Group commands #3267

@plamber

Description

@plamber

We are interacting with Microsoft 365 Groups a lot in our commands. Most of the time we are retrieving Groups by id or DisplayName to process other commands.

I think we should start introducing a utils class as we did with spo: https://github.com/pnp/cli-microsoft365/blob/b46b8928d315fabe26579d93b73d4ea843682106/src/utils/spo.ts

I would suggest that we call the utils class aadgroup and I would start with these operations. I verified the commands and can see that these are used very often:

// retrieves a unique group
getGroupById(id: string): Promise
-> reject with an error if the group can't be found

// retrieves a list of Groups by DisplayName
getGroupsByDisplayName(displayName: string): Promise<Group[]>

// retrieves a unique group by displayname
getGroupByDisplayName(displayName: string): Promise
-> reject with an error if the group can't be found
-> reject with an error if there are multiple groups with the same displayname, returning the mapped list of ids to differentiate

I would start with the implementation of the utils class first. Then we can create issues to use the utils class in our existing commands.

I would also just start with the M365 Groups. We can add optional filtering options in future evolutions.

@pnp/cli-for-microsoft-365-maintainers: feel free to add more commands to this list or change the specs.

Cheers

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions