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

Enhancement: Specify listUrl when creating a new list

Open martinlingstuyl opened this issue 1 year ago • 2 comments

When creating a list using spo list add, you can only influence it's URL by the title option.

I'd like to specify my own URL though:

Option Description
-u, --url Specify the web relative URL the list should have.

Examples

Create a new list with the title Some list and the url lists/some-list.

m365 spo list add --webUrl "https://contoso.sharepoint.com/sites/project-x" --baseTemplate GenericList --title "Some list" --url
"Lists/some-list"

martinlingstuyl avatar Aug 31 '22 11:08 martinlingstuyl

Looks good to me 👍

Only remark: for me you can drop the /Lists/ prefix, so just specify --url some-list. If I'm not mistaken, it works the same way for CSOM APIs.

Also, could you also put the API request in your spec? This way it will be easier for whoever picks up this issue, else he/she has to research everything again.

milanholemans avatar Sep 17 '22 19:09 milanholemans

for me you can drop the /Lists/ prefix, so just specify --url some-list

Well, I'd still like the freedom of picking either /Lists/some-list or just some-list. Both can be created, which is why I made it web relative.

Regarding the other point: that's okay, I'll look into it.

martinlingstuyl avatar Sep 17 '22 21:09 martinlingstuyl

@martinlingstuyl is there anything more we need to recheck here before we open this up?

Adam-it avatar Dec 10 '22 21:12 Adam-it

Yeah, I'd need to check the actual requests to update the specs.

I'm the meantime, are there any additional opinions on this @pnp/cli-for-microsoft-365-maintainers?

martinlingstuyl avatar Dec 11 '22 10:12 martinlingstuyl

We should extend the spec to indicate if the --url option is required. Also, we already use the -u short on --webUrl, so can't use it here. While it would make sense to be assigned to --url, we can do that only in v7.

waldekmastykarz avatar Dec 11 '22 18:12 waldekmastykarz

Hi people, I've just looked into it. The command currently uses the REST Api with SP.List. This class does not have a URL member. The ListCreationInformation class does have the member, but this can't be used together with the newer REST Api as far as I know. We'd have to rebuild the entire command using an older endpoint if we'd like to support it.

I'm doubting if that's worth the effort. What about you, @pnp/cli-for-microsoft-365-maintainers ?

martinlingstuyl avatar Dec 16 '22 13:12 martinlingstuyl

First and foremost, if we're to rebuild the command using the new API, can we guarantee backwards compatibility or would there be breaking changes? If the latter, we'll delay it until v7 anyway, which could mean that between now add the capabilities will changes and deciding now would be less relevant.

waldekmastykarz avatar Dec 18 '22 13:12 waldekmastykarz