Skip to content

New command: m365 spe containertype remove #5992

Closed
@Adam-it

Description

@Adam-it

Usage

m365 spe containertype remove [options]

Description

Remove a specific Container Type

Options

Option Description
-i, --id [id] The Id of the Container Type. Specify either id or name but not both.
-n, --name [name] The Container Type name. Specify either id or name but not both.
-f, --force Don't prompt for confirming removal

Examples

Removes Container Type by id

m365 spe containertype remove --id '4ec4aefd-4fa3-0e4a-20c3-6e68389e7138'

Removes Container Type by name

m365 spe containertype remove --name 'test container'

Removes Container Type by id and doesn't prompt for confirmation

m365 spe containertype remove --id '4ec4aefd-4fa3-0e4a-20c3-6e68389e7138' --force

Default properties

No response

Additional Info

We may use CSOM for this command passing the following

<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="SharePoint Online PowerShell (16.0.24322.0)"
    xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009">
    <Actions>
        <ObjectPath Id="58" ObjectPathId="57" />
        <Method Name="RemoveSPOContainerType" Id="59" ObjectPathId="57">
            <Parameters>
                <Parameter TypeId="{b66ab1ca-fd51-44f9-8cfc-01f5c2a21f99}">
                    <Property Name="ContainerTypeId" Type="Guid">{4ec4aefd-4fa3-0e4a-20c3-6e68389e7138}</Property>
                </Parameter>
            </Parameters>
        </Method>
    </Actions>
    <ObjectPaths>
        <Constructor Id="57" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" />
    </ObjectPaths>
</Request>

⚠️ Tricky part

The CSOM call does not support filtering by name only by Guid so if we want to add handling also remove the Container Type by name what we will need to do under the hood is query all Container Types and filter them by name.
Also if more than one Container Type will be found (as the name does not have to be unique) CLI (when interactive mode on) should prompt to pick the correct one based on id

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions