cli-microsoft365 icon indicating copy to clipboard operation
cli-microsoft365 copied to clipboard

New command: m365 spe container list

Open Adam-it opened this issue 1 year ago • 3 comments

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.
--deleted When set it will list the deleted containers of that specific type

Examples

List containers of a specific type

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

List deleted containers of a specific type

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

Default properties

  • id
  • displayName
  • containerTypeId
  • createdDateTime

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

in order to get deleted containers we may use

beta/storage/fileStorage/deletedContainers?$filter=containerTypeId eq {containerTypeId}

whats important to notice and we should point it out in the docs that the endpoint to get the deleted containers as of now is still beta

Adam-it avatar Jun 09 '24 20:06 Adam-it

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

  • As mentioned before, let's either remove the short option or add a short option to containerTypeName.
  • The command description seems a bit odd. Shouldn't it be: Lists containers of a specific Container Type?
  • In the option descriptions, we should write container type as Container Type (with uppercase letters)
  • Usually, if we want to list removed items we have a command like entra user recyclebinitem list, should we use the same approach here (spe container recyclebinitem list) ?

milanholemans avatar Jun 16 '24 22:06 milanholemans

@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 avatar Jun 16 '24 23:06 Adam-it

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

Adam-it avatar Jun 22 '24 21:06 Adam-it

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!

Jwaegebaert avatar Jul 09 '24 08:07 Jwaegebaert

@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}

Adam-it avatar Jul 15 '24 00:07 Adam-it

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.

Jwaegebaert avatar Jul 15 '24 07:07 Jwaegebaert

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

Adam-it avatar Jul 19 '24 00:07 Adam-it

Can I work on this?

nanddeepn avatar Sep 25 '24 01:09 nanddeepn

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.

nanddeepn avatar Sep 26 '24 12:09 nanddeepn

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.

Jwaegebaert avatar Sep 26 '24 12:09 Jwaegebaert

@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

Adam-it avatar Sep 26 '24 13:09 Adam-it