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

New command: m365 spe container recyclebinitem restore

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

Usage

m365 spe container recyclebinitem restore [options]

Description

Restores a deleted container

Options

Option Description
-i, --id [id] Container id. Specify either id or name but not both.
-n, --name [name] Display name of the Container. Specify either id or name but not both.

Examples

Restores deleted container

m365 spe container recyclebinitem restore --id "b!ISJs1WRro0y0EWgkUYcktDa0mE8zSlFEqFzqRn70Zwp1CEtDEBZgQICPkRbil_5Z"

Default properties

No response

Additional Info

we may use the following POST request:

/deletedStorageContainers/{containerId}/restore

Also when using name option we will need to run the /fileStorage/containers to list all containers and match the container by name.

what's worth noticing is that it is still beta

https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-restore?view=graph-rest-beta

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

@pnp/cli-for-microsoft-365-maintainers any feed or could we open this up?

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

Not much to add, one small detail could be to clarify the description a bit more. But besides that, ship it!

Jwaegebaert avatar Jul 09 '24 10:07 Jwaegebaert

Shouldn't we also add the option containerName to keep it consistent with other commands? Also, the name should be spe container recyclebinitem restore.

milanholemans avatar Apr 15 '25 16:04 milanholemans

Shouldn't we also add the option containerName to keep it consistent with other commands?

@milanholemans till now from what I checked I did not specify name options for the remove/get/active commands. But I will check if we may add that option. Most probably the API used here does not allow to specify by name only by id, the same goes for the GET endpoint. So most probably this would mean that when the name is used every time we would need to list all containers for that container type and find if any of the one listed match by name with what the user specified. If we are ok with that then sure I will add the name option for all the container commands previously mentioned. Also I suggest we go with name not containerName right?

Also, the name should be spe container recyclebinitem restore.

sure will update

Adam-it avatar May 08 '25 09:05 Adam-it

@milanholemans till now from what I checked I did not specify name options for the remove/get/active commands. But I will check if we may add that option. Most probably the API used here does not allow to specify by name only by id, the same goes for the GET endpoint. So most probably this would mean that when the name is used every time we would need to list all containers for that container type and find if any of the one listed match by name with what the user specified. If we are ok with that then sure I will add the name option for all the container commands previously mentioned. Also I suggest we go with name not containerName right?

That's true, it's up to the user to decide which approach he likes. We have quite some commands doing the same thing, like getting a group by name, Planner plan by name, ... We can create a util for it and reuse it everywhere.

milanholemans avatar May 08 '25 23:05 milanholemans

@milanholemans ok, I will add this option and to the releadted commands as well then

Adam-it avatar May 08 '25 23:05 Adam-it