pnp / cli-microsoft365

Manage Microsoft 365 and SharePoint Framework projects on any platform
https://aka.ms/cli-m365
MIT License
923 stars 325 forks source link

New command: m365 spp model apply #6119

Open mkm17 opened 4 months ago

mkm17 commented 4 months ago

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

Adam-it commented 4 months ago

@mkm17 awesome work 👏👏 You Rock 🤩

I have a few comments we could consider:

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

mkm17 commented 4 months ago

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

Jwaegebaert commented 4 months ago

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.

mkm17 commented 4 months ago

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

milanholemans commented 4 months ago

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?

Jwaegebaert commented 4 months ago

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

mkm17 commented 4 months ago

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

Adam-it commented 3 months ago

@mkm17 awesome work. Lets open it up 👍

mkm17 commented 3 months ago

Ok, I can take also this one ;)

Jwaegebaert commented 1 month ago

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!

mkm17 commented 1 month ago

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

mkm17 commented 1 month ago

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