New command: m365 spe container list
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
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 typeasContainer 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 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 👍
@pnp/cli-for-microsoft-365-maintainers kind reminder 🙏
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!
@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}
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.
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 throughrecyclebinitem, so it could be interesting to do the same here.
ok added #6156
Can I work on this?
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.
Please help me understand. Thank you.
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.
@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