Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New command: spo list defaultcolumnvalue clear #6505

Open
milanholemans opened this issue Nov 25, 2024 · 11 comments
Open

New command: spo list defaultcolumnvalue clear #6505

milanholemans opened this issue Nov 25, 2024 · 11 comments
Assignees
Labels
needs peer review Needs second pair of eyes to review the spec or PR new feature

Comments

@milanholemans
Copy link
Contributor

milanholemans commented Nov 25, 2024

Usage

m365 spo list defaultvalue clear [options]

Description

Clears default column values for a specific document library

Options

Option Description
-u, --webUrl <webUrl> URL of the site where the list is located.
-i, --listId [listId] ID of the list. Specify either listTitle, listId, or listUrl.
-t, --listTitle [listTitle] Title of the list. Specify either listTitle, listId, or listUrl.
--listUrl [listUrl] Server- or site-relative URL of the list. Specify either listTitle, listId, or listUrl.
--fieldName [fieldName] Internal name of the field to clear over the entire list. Specify either fieldName or folderUrl, but not both.
--folderUrl [folderUrl] Clear all fields of a specific folder. Specify either fieldName or folderUrl, but not both.
-f, --force Don't prompt for confirmation.

Examples

Remove all default column values from a library

m365 spo list defaultvalue clear --webUrl https://contoso.sharepoint.com/sites/Marketing --listTitle Logos

Clear a field from all folders of a library

m365 spo list defaultvalue clear --webUrl https://contoso.sharepoint.com/sites/Marketing --listTitle Logos --field Company

Clear all fields from a specific folder

m365 spo list defaultvalue clear --webUrl https://contoso.sharepoint.com/sites/Marketing --listTitle Logos --folderUrl "/sites/Marketing/Logos/Contoso"

Default properties

No response

Additional Info

No response

@milanholemans milanholemans added new feature needs peer review Needs second pair of eyes to review the spec or PR labels Nov 25, 2024
@milanholemans milanholemans self-assigned this Nov 25, 2024
@waldekmastykarz
Copy link
Member

I find it confusing that we use column in the command name, but field as the option to refer to the column. I suggest we align them. Since we use field everywhere else, I suggest we use field.

Are there other operations that we might want to do on a list column? If so, we should consider using the spo list field defaultvalue verb format to accommodate future changes.

@martinlingstuyl
Copy link
Contributor

I believe this is not about default values set on fields, but library default values, set on field/folder combinations. This is a spo legacy feature that by the way I've seen odd behavior with in modern document set forms.

field defaultvalue would be less clearly referring to that.

@waldekmastykarz
Copy link
Member

I understand that. I only find it confusing that we're referring to the same thing using two different words in one command. Have we considered dropping the field/column part altogether and using something like spo list defaultvalue [verb] and then use unknown options that represent field internal names to set/clear values?

@milanholemans
Copy link
Contributor Author

In the UI, it's called column default values:

image

That's why I choose this name, so people can easily find it as command. I understand that it might be confusing, what't the difference between a column and a field. However field defaultvalue might be confusing with setting a default value on a list field.
I'm not really sure why we would need unknown options?
I already made the list command: #6404, however I have no issues implementing your feedback in this command.

@waldekmastykarz
Copy link
Member

I'm not really sure why we would need unknown options?

Say we'd allow:

spo list defaultvalue clear --field1 --field2 --field3

Then field1, field2 and field3 must be unknown commands.

An alternative is to require users to run the command 3 times one for each field, with an option like --fieldName <fieldName>

@waldekmastykarz
Copy link
Member

That's why I choose this name, so people can easily find it as command. I understand that it might be confusing, what't the difference between a column and a field.

That's a typical inconsistency in the UI, like both webs and site collections being both called sites, that I believe we shouldn't copy.

@milanholemans
Copy link
Contributor Author

An alternative is to require users to run the command 3 times one for each field, with an option like --fieldName <fieldName>

Personally I would opt for this option. I'm thinking it might become confusing if you are using unknown options.

Could something like this work?

m365 spo defaultvalue clear --webUrl https://contoso.sharepoint.com/sites/Marketing --listTitle "Logos" --fieldName Company
m365 spo defaultvalue clear --webUrl https://contoso.sharepoint.com/sites/Marketing --listTitle "Logos" --folderUrl "/sites/Marketing/Logos/Contoso"

@martinlingstuyl
Copy link
Contributor

So with the first example you are clearing one field default, but with the second example you may be clearing multiple field defaults, depending on the folder value.

Seems logical to me. I'd prefer this to unknowns as well.

@milanholemans
Copy link
Contributor Author

That's the idea yeah, if you specify only fieldName, we remove the field from all folders. If you only specify folderUrl, we clear all fields from that specific folder.

@Jwaegebaert
Copy link
Contributor

Naming consistency can be such a hassle. I think going with the more generic defaultvalue approach is a solid choice. I'm also a fan of avoiding unknown options. The examples you shared look clear, and I feel this is the best way to go.

@waldekmastykarz
Copy link
Member

An alternative is to require users to run the command 3 times one for each field, with an option like --fieldName <fieldName>

Personally I would opt for this option. I'm thinking it might become confusing if you are using unknown options.

Could something like this work?

m365 spo defaultvalue clear --webUrl https://contoso.sharepoint.com/sites/Marketing --listTitle "Logos" --fieldName Company
m365 spo defaultvalue clear --webUrl https://contoso.sharepoint.com/sites/Marketing --listTitle "Logos" --folderUrl "/sites/Marketing/Logos/Contoso"

Good rationale. Let's roll with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs peer review Needs second pair of eyes to review the spec or PR new feature
Projects
None yet
Development

No branches or pull requests

4 participants