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

New command: m365 spe containertype get

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

Usage

m365 spe containertype get [options]

Description

Get 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.

Examples

Gets Container Type by id

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

Gets Container Type by name

m365 spe containertype get --name 'test container'

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="49" ObjectPathId="48" />
        <Method Name="GetSPOContainerTypeById" Id="50" ObjectPathId="48">
            <Parameters>
                <Parameter Type="Guid">{4ec4aefd-4fa3-0e4a-20c3-6e68389e7138}</Parameter>
                <Parameter Type="Enum">1</Parameter>
            </Parameters>
        </Method>
    </Actions>
    <ObjectPaths>
        <Constructor Id="48" 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 querying 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

Adam-it avatar Apr 23 '24 23:04 Adam-it

@andrewconnell any feed on 👆

Adam-it avatar Apr 23 '24 23:04 Adam-it

Sorry, no insights to share on this one.

andrewconnell avatar Apr 25 '24 13:04 andrewconnell

The only remark from my side is that get commands don't implement default properties.

milanholemans avatar Apr 25 '24 20:04 milanholemans

The only remark from my side is that get commands don't implement default properties.

Thanks for the comment. Removed. @pnp/cli-for-microsoft-365-maintainers any other comment before I open this up?

Adam-it avatar Apr 25 '24 22:04 Adam-it

No comments. Good remark about getting containers by name. Let's do this.

waldekmastykarz avatar Apr 26 '24 06:04 waldekmastykarz

Happy to work on it:)

reshmee011 avatar May 02 '24 07:05 reshmee011

Thank you!

milanholemans avatar May 02 '24 07:05 milanholemans