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

New command: m365 spp model unapply or revert

Open mkm17 opened this issue 11 months ago • 2 comments

Usage

m365 spp model unapply/revert [options]

Description

Removes a trained document understanding model from the document library.

Options

Option Description
-u, --webUrl <webUrl> The URL of the site where the library is located.
-i, --id [id] The unique ID of the model to remove. Specify id or title but not both.
-t, --title [title] The display name (case-sensitive) of the model to remove. Specify id or title but not both.
--listTitle [listTitle] The title of the library from which to remove the model. Specify either listTitle, listId, or listUrl but not multiple.
--listId [listId] The ID of the library from which to remove the model. Specify either listTitle, listId, or listUrl but not multiple.
--listUrl [listUrl] Server or web-relative URL of the library from which to remove the model. Specify either listTitle, listId, or listUrl but not multiple.
-f, --force Don't prompt for confirmation.

Examples

Removes a trained document understanding model by ID from a document library based on the list title.

m365 spp model unapply --webUrl 'https://contoso.sharepoint.com' --id '7645e69d-21fb-4a24-a17a-9bdfa7cb63dc' --listTitle 'Shared Documents'

Removes a trained document understanding model by title from a document library based on the list title.

m365 spp model unapply --webUrl 'https://contoso.sharepoint.com' --title 'ModelExample' --listTitle 'Shared Documents'

Removes a trained document understanding model by title from a document library based on the list URL.

m365 spp model unapply --webUrl 'https://contoso.sharepoint.com' --title 'ModelExample' --listUrl '/Shared Documents'

Default properties

No response

Additional Info

No response

mkm17 avatar Feb 01 '25 12:02 mkm17

Great suggestion and an awesome spec. I'm not convinced about the verb though. Ideally, it would be remove but there's a difference between removing (deleting) a model and removing it from a doc lib.

Would it also work if we had a spp model delete command where the list is optional? If specified, removes the model from the doc lib. If not specified, it removes the model altogether. Thoughts @pnp/cli-for-microsoft-365-maintainers?

waldekmastykarz avatar Feb 08 '25 16:02 waldekmastykarz

Would it also work if we had a spp model delete command where the list is optional? If specified, removes the model from the doc lib. If not specified, it removes the model altogether. Thoughts @pnp/cli-for-microsoft-365-maintainers?

that's not a bad idea. But why delete instead of remove? I think usually we use the second one.

Adam-it avatar Feb 13 '25 08:02 Adam-it

Hi @Adam-it and @waldekmastykarz I have updated the command. I used the publicationUrls parameter as the name because in spp model get, we use the --withPublications parameter to include all libraries where the model is used.

Could you advise on how to handle the current behavior of the spp model remove command? We’ve added a note that the command will not delete the model until it has been removed from all libraries. Should we remove all model publications when --publicationUrls is empty?

mkm17 avatar Jun 26 '25 20:06 mkm17

I'm a fan of keeping just one command too, but leaving publicationUrls empty to trigger removal from all libraries feels a bit risky. Maybe we could go for something more explicit like adding a --removeAll option? That way it’s clear and intentional when someone wants to remove all publications.

Jwaegebaert avatar Jun 27 '25 12:06 Jwaegebaert

maybe I am a bit lost but if we would just run spp model remove without using publicationUrls couldn't it just remove all model publications 🤔 So lets say the model was used in A, B and C if we run spp model remove --publicationUrls A, B we just remove from A and B but if we just run spp model remove we remove the publications from A, B and C and the model itself

we should have a --force option BTW as well. maybe in the prompt for confirmation when we run spp model remove and the --force option is not used we could point out all the publications that will be removed 🤔

Adam-it avatar Jun 30 '25 09:06 Adam-it

The force option is already available on the command

Jwaegebaert avatar Jun 30 '25 11:06 Jwaegebaert