-
Notifications
You must be signed in to change notification settings - Fork 336
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
base: main
Are you sure you want to change the base?
Changes from all commits
9d03ab7
8dc09f5
3e5c95f
fc794ce
ff5a49d
e7c730e
04d5137
ed73400
c9b59fe
6eaee7c
5959d06
8298499
585a2e7
c29f8e2
2b8a86d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -19,13 +19,16 @@ m365 spo list get [options] | |||||
: URL of the site where the list to retrieve is located. | ||||||
|
||||||
`-i, --id [id]` | ||||||
: ID of the list to retrieve information for. Specify either `id`, `title`, or `url` but not multiple. | ||||||
: ID of the list to retrieve information for. Specify either `id`, `title`,`url` or `default` but not multiple. | ||||||
|
||||||
`-t, --title [title]` | ||||||
: Title of the list to retrieve information for. Specify either `id`, `title`, or `url` but not multiple. | ||||||
: Title of the list to retrieve information for. Specify either `id`, `title`,`url` or `default` but not multiple. | ||||||
|
||||||
`--url [url]` | ||||||
: Server- or site-relative URL of the list. Specify either `id`, `title`, or `url` but not multiple. | ||||||
: Server- or site-relative URL of the list. Specify either `id`, `title`,`url` or `default` but not multiple. | ||||||
|
||||||
`--default` | ||||||
: Set if you want to return the default list from the site. Specify either `id`, `title`, `url` or `default` but not multiple. | ||||||
|
||||||
`-p, --properties [properties]` | ||||||
: Comma-separated list of properties to retrieve from the list. Will retrieve all properties possible from default response, if not specified. | ||||||
|
@@ -42,6 +45,12 @@ When the `properties` option includes values with a `/`, for example: `ListItemA | |||||
|
||||||
## Examples | ||||||
|
||||||
Get the default document library located in the specified site. | ||||||
|
||||||
```sh | ||||||
m365 spo list get --webUrl https://contoso.sharepoint.com/sites/project-x | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
``` | ||||||
|
||||||
Get information about a list with specified ID located in the specified site. | ||||||
|
||||||
```sh | ||||||
|
@@ -66,6 +75,12 @@ Get information about a list with specified site-relative URL located in the spe | |||||
m365 spo list get --url 'Shared Documents' --webUrl https://contoso.sharepoint.com/sites/project-x | ||||||
``` | ||||||
|
||||||
Get information about the default (document) located in the specified site. | ||||||
|
||||||
```sh | ||||||
m365 spo list get --webUrl https://contoso.sharepoint.com/sites/project-x --default | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's not use the same example twice. |
||||||
``` | ||||||
|
||||||
Get information about a list returning the specified list properties. | ||||||
|
||||||
```sh | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -177,7 +177,7 @@ | |
"Levert, Sebastien <[email protected]>", | ||
"Lingstuyl, Martin <[email protected]>", | ||
"Macháček, Martin <[email protected]>", | ||
"Maestrini Tobias <tobias@bee365.ch>", | ||
"Maestrini, Tobias <tobias[email protected]>", | ||
"Maillot, Michaël <[email protected]>", | ||
"Mastykarz, Waldek <[email protected]>", | ||
"McDonnell, Kevin <[email protected]>", | ||
|
tmaestrini marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -25,6 +25,7 @@ interface Options extends GlobalOptions { | |||||
url?: string; | ||||||
properties?: string; | ||||||
withPermissions?: boolean; | ||||||
default?: boolean; | ||||||
} | ||||||
|
||||||
class SpoListGetCommand extends SpoCommand { | ||||||
|
@@ -35,7 +36,7 @@ class SpoListGetCommand extends SpoCommand { | |||||
} | ||||||
|
||||||
public get description(): string { | ||||||
return 'Gets information about the specific list'; | ||||||
return 'Gets information about the specific list or returns information about the default list in a site'; | ||||||
tmaestrini marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's not modify the description. |
||||||
} | ||||||
|
||||||
constructor() { | ||||||
|
@@ -54,7 +55,8 @@ class SpoListGetCommand extends SpoCommand { | |||||
title: (!(!args.options.title)).toString(), | ||||||
url: (!(!args.options.url)).toString(), | ||||||
properties: (!(!args.options.properties)).toString(), | ||||||
withPermissions: typeof args.options.withPermissions !== 'undefined' | ||||||
withPermissions: typeof args.options.withPermissions !== 'undefined', | ||||||
default: typeof args.options.default !== 'undefined' | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
}); | ||||||
}); | ||||||
} | ||||||
|
@@ -73,6 +75,9 @@ class SpoListGetCommand extends SpoCommand { | |||||
{ | ||||||
option: '--url [url]' | ||||||
}, | ||||||
{ | ||||||
option: '--default' | ||||||
}, | ||||||
{ | ||||||
option: '-p, --properties [properties]' | ||||||
}, | ||||||
|
@@ -102,7 +107,7 @@ class SpoListGetCommand extends SpoCommand { | |||||
} | ||||||
|
||||||
#initOptionSets(): void { | ||||||
this.optionSets.push({ options: ['id', 'title', 'url'] }); | ||||||
this.optionSets.push({ options: ['id', 'title', 'url', 'default'] }); | ||||||
} | ||||||
|
||||||
public async commandAction(logger: Logger, args: CommandArgs): Promise<void> { | ||||||
|
@@ -122,6 +127,9 @@ class SpoListGetCommand extends SpoCommand { | |||||
const listServerRelativeUrl: string = urlUtil.getServerRelativePath(args.options.webUrl, args.options.url); | ||||||
requestUrl += `GetList('${formatting.encodeQueryParameter(listServerRelativeUrl)}')`; | ||||||
} | ||||||
else if (args.options.default) { | ||||||
requestUrl += `DefaultDocumentLibrary`; | ||||||
} | ||||||
|
||||||
const fieldsProperties: Properties = this.formatSelectProperties(args.options.properties, args.options.withPermissions); | ||||||
const queryParams: string[] = []; | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.