pnp / cli-microsoft365

Manage Microsoft 365 and SharePoint Framework projects on any platform
https://aka.ms/cli-m365
MIT License
911 stars 319 forks source link

New command: m365 spe container list #6082

Open Adam-it opened 3 months ago

Adam-it commented 3 months ago

Usage

m365 spe container list [options]

Description

Lists containers of a specific Container Type

Options

Option Description
--containerTypeId [containerTypeId] The Container Type Id of the container instance. Use either containerTypeId or containerTypeName but not both
--containerTypeName [containerTypeName] The Container Type name of the container instance. Use either containerTypeId or containerTypeName but not both.

Examples

List containers of a specific type

m365 spe container list --containerTypeId "91710488-5756-407f-9046-fbe5f0b4de73"

Default properties

Additional Info

We may use the following GET request to get this:

/storage/fileStorage/containers?$filter=containerTypeId eq {containerTypeId}

https://learn.microsoft.com/en-us/graph/api/filestorage-list-containers?view=graph-rest-1.0&tabs=http

milanholemans commented 3 months ago

Hi @Adam-it, few remarks from my side:

Adam-it commented 3 months ago

@milanholemans thanks for the feed. I applied all except the last one. I don't have a strong opinion about it and I guess it does make sense. Lets wait for maybe some additional comment from another @pnp/cli-for-microsoft-365-maintainers on that point and move from there. Thanks for having a look at my issue 👍

Adam-it commented 3 months ago

@pnp/cli-for-microsoft-365-maintainers kind reminder 🙏

Jwaegebaert commented 2 months ago

Personally, I'm also more keen on the idea of creating a separate command for deleted items as it gives more clarity than an option here.

Besides that, the specs look very clear to me, nice work @Adam-it!

Adam-it commented 2 months ago

@milanholemans, @Jwaegebaert I removed the deleted option and I will spec out a separate command for getting the deleted items. Any suggestions how we should name this command?

how to get deleted items

beta/storage/fileStorage/deletedContainers?$filter=containerTypeId eq {containerTypeId}
Jwaegebaert commented 2 months ago

Maybe something down the line with what @milanholemans mentioned, spe container recyclebinitem list. We already have several command groups available that handle actions with deleted items through recyclebinitem, so it could be interesting to do the same here.

Adam-it commented 2 months ago

Maybe something down the line with what @milanholemans mentioned, spe container recyclebinitem list. We already have several command groups available that handle actions with deleted items through recyclebinitem, so it could be interesting to do the same here.

ok added #6156

nanddeepn commented 1 week ago

Can I work on this?

nanddeepn commented 1 week ago

Hi @Adam-it Sorry, I did not get the purpose of option containerTypeName.

Below is an example of one of the Container properties. It has got containerTypeId but no property named as containerTypeName. image

Please help me understand. Thank you.

Jwaegebaert commented 1 week ago

We'll need some logic that can find the proper container type by its displayName, and then use that object's ID to fetch all the related containers.

Adam-it commented 1 week ago

@nanddeepn containers don't have this property. In case someone will use containerTypeName in the command we first need to query the Container Type by its name to get its ID. After that we may just query all containers by containerTypeID.

This is a help for users that will allow them to operate using names rather than GUIDs