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

New command: m365 spp model apply

Open mkm17 opened this issue 1 year ago • 12 comments

Usage

m365 spp model apply [options]

Description

Applies (or syncs) a trained document understanding model to a 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 retrieve. Specify id or title but not both.
-t, --title [title] The display name (case-sensitive) of the model to retrieve. Specify id or title but not both.
--listTitle [listTitle] The title of the library on which to apply the model. Specify either listTitle, listId, or listUrl but not multiple.
--listId [listId] The ID of the library on which to apply the model. Specify either listTitle, listId, or listUrl but not multiple.
--listUrl [listUrl] Server or web-relative URL of the library on which to apply the model. Specify either listTitle, listId, or listUrl but not multiple.
--defaultView Specifies whether to set the new model view as the library default

Examples

Applies a trained document understanding model by id to a document library based on the list title.

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

Applies a trained document understanding model by title to a document library based on the list title.

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

Applies a trained document understanding model by title to a document library based on the list url.

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

Applies a trained document understanding model by title to a document library based on the list id.

m365 spp model apply --webUrl 'https://contoso.sharepoint.com' --title 'ModelExample' --listId 'b4cfa0d9-b3d7-49ae-a0f0-f14ffdd005f7'

Additional Info

This endpoint can be used: https://learn.microsoft.com/en-us/sharepoint/dev/apis/syntex/rest-applymodel-method

mkm17 avatar Jul 04 '24 05:07 mkm17

@mkm17 awesome work 👏👏 You Rock 🤩

I have a few comments we could consider:

  • why do we specify default properties? Do we expect this command will return some list?
  • what are possible values we may provide to viewOption? if it's only NewViewAsDefault I would suggest we specify this as flag option in our command and then we should specify it like this in spec --viewOption so withouth [viewOption]
  • could we also model by title and specify to use ether title or id
  • lets use id instead of modelUniqueId. First of all since the command is spo stx model apply then the model word does not need to be duplicated in the options. Also id will be more aligned with what is typically used in CLI already
  • libraryUrl I don't quite feel this naming. Usually we use list... but I get it that we should only support libs not lists... hmm usually in such a case we have like folderRelativeUrl or something similar.. but I man sure how to correct this naming here🤔

@pnp/cli-for-microsoft-365-maintainers any other feed? or suggestion on my last point 👆

Adam-it avatar Jul 05 '24 11:07 Adam-it

@Adam-it ok, I have removed siteUrl and added folderUrl. It is a similar approach to the file add command. The rest of your comments have been applied.

mkm17 avatar Jul 09 '24 21:07 mkm17

Another great job @mkm17!

I also would suggest removing the default properties. This won't be a list command so it isn't necessary here to specify them. Regarding --viewOption, I'm not quite sure about the name for this option as it sounds a bit vague compared to the description. Maybe something like --viewDefault or --defaultModel. I would also opt for --folderUrl, which looks clear enough.

Jwaegebaert avatar Jul 10 '24 06:07 Jwaegebaert

@Jwaegebaert what about --newDefaultView as a name of the option?

mkm17 avatar Jul 10 '24 14:07 mkm17

To me folderUrl isn't that clear. It looks like I can specify any folder in a list which isn't the case right? Why not try to be consistent and use listTitle, listUrl, listId? Even if you can only specify doc libraries, I think we can still use these options?

milanholemans avatar Jul 10 '24 15:07 milanholemans

@Jwaegebaert what about --newDefaultView as a name of the option?

I find the new part a bit vague and feel it doesn't add much meaning to what it does, but on the other hand, defaultView seems like a good way to go about it.

Why not try to be consistent and use listTitle, listUrl, listId? Even if you can only specify doc libraries, I think we can still use these options?

It seems like we aren't very consistent yet. Most commands do use this casing, but it's not everywhere just yet. Still, it's a good idea to apply similar naming here too.

Jwaegebaert avatar Jul 11 '24 07:07 Jwaegebaert

Ok, I have taken the same approach as in the sensitivitylabel

mkm17 avatar Jul 12 '24 13:07 mkm17

@mkm17 awesome work. Lets open it up 👍

Adam-it avatar Jul 23 '24 08:07 Adam-it

Ok, I can take also this one ;)

mkm17 avatar Jul 28 '24 18:07 mkm17

Hey @mkm17, thank you for all the hard work you’ve put in, it’s really appreciated! We’ve noticed that you have several issues assigned that haven't yet been created with a PR. To ensure everyone has a chance to get involved, especially with Hacktoberfest, I’ll be unassigning you from some of these issues.

We recommend focusing on 1 to 2 issues at a time. Once you’ve submitted a PR for an issue, you can easily claim another open one. This approach helps you manage the workload more effectively and ensures you can give each task the attention it needs.

Thanks again for your continued contributions!

Jwaegebaert avatar Sep 26 '24 12:09 Jwaegebaert

@Jwaegebaert Omg, time passed so quickly. Yes, definitely let's open it to everyone. Thanks!

mkm17 avatar Sep 26 '24 13:09 mkm17

@Jwaegebaert the same with this one, can I take it?

mkm17 avatar Oct 06 '24 10:10 mkm17