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

Extends 'spo list get' command with support for retrieving any default list in a given site #6447

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

tmaestrini
Copy link

Closes #5856.

This PR substitutes PR #6445

@tmaestrini tmaestrini changed the title 5856 retrieve default list in site Extends 'spo list get' command with support for retrieving any default list in a given site Oct 22, 2024
@milanholemans
Copy link
Contributor

Thanks, we'll have a look at it ASAP.

@Adam-it Adam-it added the hacktoberfest-accepted Accept for hacktoberfest, will merge later label Oct 29, 2024
@Adam-it
Copy link
Member

Adam-it commented Oct 29, 2024

@tmaestrini I added the hacktoberfest-accepted label to this PR which means that this PR will count as done for the Hacktoberfest event. So if you participate in this event it will get you unblocked and it allows us to merge this PR later when we catch up 👍
Thanks for your support and awesome contribution 👏 You Rock 🤩

@tmaestrini
Copy link
Author

@Adam-it Thanks a lot! :) Looking forward to my very first contribution on the M365 cli when this PR gets closed! ;)

@tmaestrini
Copy link
Author

Do you want me to do something on this? Is there anything missing?

@Adam-it
Copy link
Member

Adam-it commented Nov 7, 2024

Do you want me to do something on this? Is there anything missing?

@tmaestrini I don't think there is anything missing. We have a lot of PRs to process but we will try to catch up with this ASAP

@milanholemans milanholemans self-assigned this Dec 8, 2024
Copy link
Contributor

@milanholemans milanholemans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @tmaestrini, I suggest we make some minor changes.

src/m365/spo/commands/list/list-get.ts Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add another example to the docs where we retrieve the default list.

Copy link
Author

@tmaestrini tmaestrini Dec 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, will do so 👍.
I will include this example in the "Examples" section on https://pnp.github.io/cli-microsoft365/cmd/spo/list/list-get/:

Get the default document library located in the specified site.

m365 spo list get --webUrl https://contoso.sharepoint.com/sites/project-x

Can you tell me: the response differs in this case because the script returns the properties of the default libraries. How should I document this in the "Response" section?

src/m365/spo/commands/list/list-get.ts Show resolved Hide resolved
it('retrieves the default list in the specified site by providing a webUrl', async () => {
const defaultSiteList = { ...listResponse, BaseTemplate: 101, ParentWebUrl: "/", ListItemEntityTypeFullName: "SP.Data.Shared_x0020_DocumentsItem" };

sinon.stub(request, 'get').resolves({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's check that the right URL was passed.

Copy link
Author

@tmaestrini tmaestrini Dec 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@milanholemans What do you mean by this statement? I mean we we test if a user only passes the webUrl option. Then – and only then – the default document library is returned.
I probably don't understand how or why you want to check if the correct URL has been passed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just like in other tests, instead of a sinon.stub(...).resolves(...), we should do sinon.stub(...).callsFake(opts => if (opts.url === <URL>) return result;. This way we ensure that the right request was made.

src/m365/spo/commands/list/list-get.spec.ts Show resolved Hide resolved
@milanholemans milanholemans marked this pull request as draft December 8, 2024 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted Accept for hacktoberfest, will merge later
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhancement: Retrieve default list in site
3 participants