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

New command: update content type

Open waldekmastykarz opened this issue 3 years ago • 13 comments

Usage

m365 spo contenttype set [options]

Description

Update existing content type

Options

Option Description
-u, --webUrl <webUrl> URL of the site where the content type to update is defined
-i, --id [id] ID of the content type to update. Specify the ID or name but not both, one is required.
-n, --name [name] Name of the content type to update. Specify the ID or the name but not both, one is required
--listTitle [listTitle] Name of the list if you want to update a list content type. Specify either listTitle, listId or listUrl
--listId [listId] ID of the list if you want to update a list content type. Specify either listTitle, listId or listUrl
--listUrl [listUrl] URL of the list if you want to update a list content type. Specify either listTitle, listId or listUrl

Examples

Move site content type to a different group:

m365 spo contenttype set --id 0x001001 --webUrl https://contoso.sharepoint.com --Group "My group"

Rename list content type:

m365 spo contenttype set --id 0x001001 --webUrl https://contoso.sharepoint.com --listTitle "My list" --Name "My item"

Additional Info

This command supports using unknown properties. Unknown properties map to the properties of the ContentType CSOM object that support setting a value. This command is highly useful for scenarios like deploying SPFx form customizers.

waldekmastykarz avatar Aug 24 '22 10:08 waldekmastykarz

@pnp/cli-for-microsoft-365-maintainers any feedback?

waldekmastykarz avatar Aug 24 '22 10:08 waldekmastykarz

Looks good to me 👍 Only comment I have is to maybe provide another useful example.

milanholemans avatar Aug 24 '22 11:08 milanholemans

Any common content type update operations that you'd suggest @milanholemans?

waldekmastykarz avatar Aug 24 '22 12:08 waldekmastykarz

Was thinking something like setting fields of content types. But just noticed we have separate commands for that spo contenttype field set|remove. Maybe an extra example to update the content type group or description? No idea what else could be useful.

milanholemans avatar Aug 24 '22 12:08 milanholemans

Great suggestion! 🚀

Should we maybe mention with the options listTitle and listId that one of them is required when they want to update a list content type. Also, maybe an example of how to update a list content type could be nice to have.

Jwaegebaert avatar Aug 24 '22 12:08 Jwaegebaert

maybe we could also add --listUrl 🤔? @milanholemans, @waldekmastykarz I think a good example would be to change a description of the CT <Property Name="Description" Type="String"/> or CT Group <Property Name="Group" Type="String">

Adam-it avatar Aug 24 '22 14:08 Adam-it

This command is highly useful for scenarios like deploying SPFx form customizers.

Now I'm curious @waldekmastykarz!

Looks great by the way

martinlingstuyl avatar Aug 24 '22 18:08 martinlingstuyl

Now I'm curious @waldekmastykarz!

Come watch my demo on the community call today 😄

waldekmastykarz avatar Aug 25 '22 07:08 waldekmastykarz

@milanholemans:

Maybe an extra example to update the content type group or description

Great suggestion, updated spec

@Jwaegebaert:

Should we maybe mention with the options listTitle and listId that one of them is required when they want to update a list content type

Isn't the current description Name of the list if you want to update a list content type. clear? Would it be clearer to repeat it?

Also, maybe an example of how to update a list content type could be nice to have.

Good idea! Updated the spec.

@Adam-it:

maybe we could also add --listUrl

Yes! Updated the spec

waldekmastykarz avatar Aug 25 '22 07:08 waldekmastykarz

Isn't the current description Name of the list if you want to update a list content type. clear? Would it be clearer to repeat it?

Yeah, on second thought, that should be clear enough for the users 😄

Jwaegebaert avatar Aug 25 '22 07:08 Jwaegebaert

Come watch my demo on the community call today 😄

Ah, I see. so you can add ContentType.DisplayFormClientComponentProperties 😉

martinlingstuyl avatar Aug 26 '22 14:08 martinlingstuyl

Exactly!

waldekmastykarz avatar Aug 28 '22 17:08 waldekmastykarz

Exactly!

BTW nice demo 👍.

Adam-it avatar Aug 28 '22 18:08 Adam-it