@pnp/cli-microsoft365 5.3.0-beta.ebb13d0 → 5.4.0-beta.3879fc9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.devcontainer/Dockerfile +1 -1
- package/dist/m365/planner/commands/bucket/bucket-get.js +1 -1
- package/dist/m365/planner/commands/bucket/bucket-remove.js +2 -2
- package/dist/m365/planner/commands/bucket/bucket-set.js +1 -1
- package/dist/m365/planner/commands/task/task-get.js +22 -6
- package/dist/m365/planner/commands/task/task-remove.js +201 -0
- package/dist/m365/planner/commands.js +2 -1
- package/dist/m365/search/commands/externalconnection/externalconnection-list.js +26 -0
- package/dist/m365/search/commands.js +2 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002009_DEVDEP_microsoft_sp_tslint_rules.js +2 -2
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002018_DEVDEP_microsoft_rush_stack_compiler_3_9.js +2 -2
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002020_DEVDEP_microsoft_rush_stack_compiler_4_5.js +17 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002021_DEVDEP_rushstack_eslint_config.js +14 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002022_DEVDEP_microsoft_eslint_plugin_spfx.js +14 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002023_DEVDEP_microsoft_eslint_config_spfx.js +14 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002024_DEVDEP_eslint.js +14 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002025_DEVDEP_eslint_plugin_react_hooks.js +18 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015008_FILE_eslintrc_js.js +14 -0
- package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.15.0-beta.6.js → upgrade-1.15.0-rc.0.js} +49 -25
- package/dist/m365/spfx/commands/project/project-upgrade.js +1 -1
- package/dist/m365/spo/commands/contenttype/contenttype-add.js +1 -1
- package/dist/m365/spo/commands/contenttype/contenttype-field-remove.js +1 -1
- package/dist/m365/spo/commands/contenttype/contenttype-get.js +1 -1
- package/dist/m365/spo/commands/eventreceiver/eventreceiver-get.js +119 -0
- package/dist/m365/spo/commands/field/field-add.js +1 -1
- package/dist/m365/spo/commands/field/field-get.js +5 -5
- package/dist/m365/spo/commands/field/field-list.js +3 -3
- package/dist/m365/spo/commands/field/field-remove.js +5 -5
- package/dist/m365/spo/commands/file/file-sharinginfo-get.js +1 -1
- package/dist/m365/spo/commands/list/list-contenttype-add.js +3 -3
- package/dist/m365/spo/commands/list/list-contenttype-default-set.js +2 -2
- package/dist/m365/spo/commands/list/list-contenttype-list.js +3 -3
- package/dist/m365/spo/commands/list/list-contenttype-remove.js +3 -3
- package/dist/m365/spo/commands/list/list-get.js +2 -2
- package/dist/m365/spo/commands/list/list-label-get.js +3 -3
- package/dist/m365/spo/commands/list/list-label-set.js +2 -2
- package/dist/m365/spo/commands/list/list-remove.js +2 -2
- package/dist/m365/spo/commands/list/list-roleinheritance-break.js +2 -2
- package/dist/m365/spo/commands/list/list-roleinheritance-reset.js +2 -2
- package/dist/m365/spo/commands/list/list-sitescript-get.js +3 -3
- package/dist/m365/spo/commands/list/list-view-add.js +116 -0
- package/dist/m365/spo/commands/list/list-view-field-add.js +2 -2
- package/dist/m365/spo/commands/list/list-view-field-remove.js +2 -2
- package/dist/m365/spo/commands/list/list-view-field-set.js +2 -2
- package/dist/m365/spo/commands/list/list-view-get.js +4 -4
- package/dist/m365/spo/commands/list/list-view-list.js +3 -3
- package/dist/m365/spo/commands/list/list-view-remove.js +3 -3
- package/dist/m365/spo/commands/list/list-view-set.js +3 -3
- package/dist/m365/spo/commands/list/list-webhook-add.js +3 -3
- package/dist/m365/spo/commands/list/list-webhook-get.js +3 -3
- package/dist/m365/spo/commands/list/list-webhook-list.js +5 -5
- package/dist/m365/spo/commands/list/list-webhook-remove.js +4 -4
- package/dist/m365/spo/commands/list/list-webhook-set.js +3 -3
- package/dist/m365/spo/commands/listitem/listitem-add.js +2 -2
- package/dist/m365/spo/commands/listitem/listitem-attachment-list.js +2 -2
- package/dist/m365/spo/commands/listitem/listitem-get.js +2 -2
- package/dist/m365/spo/commands/listitem/listitem-isrecord.js +2 -2
- package/dist/m365/spo/commands/listitem/listitem-list.js +2 -2
- package/dist/m365/spo/commands/listitem/listitem-record-declare.js +2 -2
- package/dist/m365/spo/commands/listitem/listitem-record-undeclare.js +2 -2
- package/dist/m365/spo/commands/listitem/listitem-remove.js +2 -2
- package/dist/m365/spo/commands/listitem/listitem-roleinheritance-break.js +2 -2
- package/dist/m365/spo/commands/listitem/listitem-roleinheritance-reset.js +2 -2
- package/dist/m365/spo/commands/listitem/listitem-set.js +2 -2
- package/dist/m365/spo/commands.js +2 -0
- package/dist/utils/validation.js +12 -2
- package/docs/docs/cmd/planner/bucket/bucket-get.md +1 -1
- package/docs/docs/cmd/planner/bucket/bucket-remove.md +2 -2
- package/docs/docs/cmd/planner/bucket/bucket-set.md +5 -5
- package/docs/docs/cmd/planner/plan/plan-details-get.md +2 -2
- package/docs/docs/cmd/planner/plan/plan-get.md +4 -4
- package/docs/docs/cmd/planner/task/task-get.md +4 -9
- package/docs/docs/cmd/planner/task/task-list.md +2 -2
- package/docs/docs/cmd/planner/task/task-remove.md +78 -0
- package/docs/docs/cmd/planner/task/task-set.md +2 -2
- package/docs/docs/cmd/search/externalconnection/externalconnection-list.md +21 -0
- package/docs/docs/cmd/spfx/project/project-upgrade.md +1 -1
- package/docs/docs/cmd/spo/eventreceiver/eventreceiver-get.md +70 -0
- package/docs/docs/cmd/spo/file/file-checkout.md +1 -1
- package/docs/docs/cmd/spo/list/list-view-add.md +76 -0
- package/docs/docs/cmd/spo/listitem/listitem-roleinheritance-break.md +2 -2
- package/npm-shrinkwrap.json +257 -1104
- package/package.json +25 -20
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const request_1 = require("../../../../request");
|
|
4
|
+
const utils_1 = require("../../../../utils");
|
|
5
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
6
|
+
const commands_1 = require("../../commands");
|
|
7
|
+
class SpoEventreceiverGetCommand extends SpoCommand_1.default {
|
|
8
|
+
get name() {
|
|
9
|
+
return commands_1.default.EVENTRECEIVER_GET;
|
|
10
|
+
}
|
|
11
|
+
get description() {
|
|
12
|
+
return 'Gets a specific event receiver attached to the web, site or list (if any of the list options are filled in) by receiver name of id';
|
|
13
|
+
}
|
|
14
|
+
getTelemetryProperties(args) {
|
|
15
|
+
const telemetryProps = super.getTelemetryProperties(args);
|
|
16
|
+
telemetryProps.listId = typeof args.options.listId !== 'undefined';
|
|
17
|
+
telemetryProps.listTitle = typeof args.options.listTitle !== 'undefined';
|
|
18
|
+
telemetryProps.listUrl = typeof args.options.listUrl !== 'undefined';
|
|
19
|
+
telemetryProps.scope = typeof args.options.scope !== 'undefined';
|
|
20
|
+
telemetryProps.id = typeof args.options.id !== 'undefined';
|
|
21
|
+
telemetryProps.name = typeof args.options.name !== 'undefined';
|
|
22
|
+
return telemetryProps;
|
|
23
|
+
}
|
|
24
|
+
commandAction(logger, args, cb) {
|
|
25
|
+
let requestUrl = `${args.options.webUrl}/_api/`;
|
|
26
|
+
let listUrl = '';
|
|
27
|
+
let filter = '?$filter=';
|
|
28
|
+
if (args.options.listId) {
|
|
29
|
+
listUrl = `lists(guid'${utils_1.formatting.encodeQueryParameter(args.options.listId)}')/`;
|
|
30
|
+
}
|
|
31
|
+
else if (args.options.listTitle) {
|
|
32
|
+
listUrl = `lists/getByTitle('${utils_1.formatting.encodeQueryParameter(args.options.listTitle)}')/`;
|
|
33
|
+
}
|
|
34
|
+
else if (args.options.listUrl) {
|
|
35
|
+
const listServerRelativeUrl = utils_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
|
|
36
|
+
listUrl = `GetList('${utils_1.formatting.encodeQueryParameter(listServerRelativeUrl)}')/`;
|
|
37
|
+
}
|
|
38
|
+
if (!args.options.scope || args.options.scope === 'web') {
|
|
39
|
+
requestUrl += `web/${listUrl}eventreceivers`;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
requestUrl += 'site/eventreceivers';
|
|
43
|
+
}
|
|
44
|
+
if (args.options.id) {
|
|
45
|
+
filter += `receiverid eq (guid'${args.options.id}')`;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
filter += `receivername eq '${args.options.name}'`;
|
|
49
|
+
}
|
|
50
|
+
const requestOptions = {
|
|
51
|
+
url: requestUrl + filter,
|
|
52
|
+
headers: {
|
|
53
|
+
'accept': 'application/json;odata=nometadata'
|
|
54
|
+
},
|
|
55
|
+
responseType: 'json'
|
|
56
|
+
};
|
|
57
|
+
request_1.default
|
|
58
|
+
.get(requestOptions)
|
|
59
|
+
.then((res) => {
|
|
60
|
+
logger.log(res.value);
|
|
61
|
+
cb();
|
|
62
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
63
|
+
}
|
|
64
|
+
options() {
|
|
65
|
+
const options = [
|
|
66
|
+
{
|
|
67
|
+
option: '-u, --webUrl <webUrl>'
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
option: '--listTitle [listTitle]'
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
option: '--listId [listId]'
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
option: '--listUrl [listUrl]'
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
option: '-n, --name [name]'
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
option: '-i, --id [id]'
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
option: '-s, --scope [scope]',
|
|
86
|
+
autocomplete: ['web', 'site']
|
|
87
|
+
}
|
|
88
|
+
];
|
|
89
|
+
const parentOptions = super.options();
|
|
90
|
+
return options.concat(parentOptions);
|
|
91
|
+
}
|
|
92
|
+
optionSets() {
|
|
93
|
+
return [
|
|
94
|
+
['name', 'id']
|
|
95
|
+
];
|
|
96
|
+
}
|
|
97
|
+
validate(args) {
|
|
98
|
+
const isValidSharePointUrl = utils_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
99
|
+
if (isValidSharePointUrl !== true) {
|
|
100
|
+
return isValidSharePointUrl;
|
|
101
|
+
}
|
|
102
|
+
const listOptions = [args.options.listId, args.options.listTitle, args.options.listUrl];
|
|
103
|
+
if (listOptions.some(item => item !== undefined) && listOptions.filter(item => item !== undefined).length > 1) {
|
|
104
|
+
return `Specify either list id or title or list url`;
|
|
105
|
+
}
|
|
106
|
+
if (args.options.listId && !utils_1.validation.isValidGuid(args.options.listId)) {
|
|
107
|
+
return `${args.options.listId} is not a valid GUID`;
|
|
108
|
+
}
|
|
109
|
+
if (args.options.scope && ['web', 'site'].indexOf(args.options.scope) === -1) {
|
|
110
|
+
return `${args.options.scope} is not a valid type value. Allowed values web|site.`;
|
|
111
|
+
}
|
|
112
|
+
if (args.options.scope && args.options.scope === 'site' && (args.options.listId || args.options.listUrl || args.options.listTitle)) {
|
|
113
|
+
return 'Scope cannot be set to site when retrieving list event receivers.';
|
|
114
|
+
}
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
module.exports = new SpoEventreceiverGetCommand();
|
|
119
|
+
//# sourceMappingURL=eventreceiver-get.js.map
|
|
@@ -16,7 +16,7 @@ class SpoFieldAddCommand extends SpoCommand_1.default {
|
|
|
16
16
|
.getRequestDigest(args.options.webUrl)
|
|
17
17
|
.then((res) => {
|
|
18
18
|
const requestOptions = {
|
|
19
|
-
url: `${args.options.webUrl}/_api/web/${(args.options.listTitle ? `lists/getByTitle('${
|
|
19
|
+
url: `${args.options.webUrl}/_api/web/${(args.options.listTitle ? `lists/getByTitle('${utils_1.formatting.encodeQueryParameter(args.options.listTitle)}')/` : '')}fields/CreateFieldAsXml`,
|
|
20
20
|
headers: {
|
|
21
21
|
'X-RequestDigest': res.FormDigestValue,
|
|
22
22
|
accept: 'application/json;odata=nometadata'
|
|
@@ -23,21 +23,21 @@ class SpoFieldGetCommand extends SpoCommand_1.default {
|
|
|
23
23
|
commandAction(logger, args, cb) {
|
|
24
24
|
let listRestUrl = '';
|
|
25
25
|
if (args.options.listId) {
|
|
26
|
-
listRestUrl = `lists(guid'${
|
|
26
|
+
listRestUrl = `lists(guid'${utils_1.formatting.encodeQueryParameter(args.options.listId)}')/`;
|
|
27
27
|
}
|
|
28
28
|
else if (args.options.listTitle) {
|
|
29
|
-
listRestUrl = `lists/getByTitle('${
|
|
29
|
+
listRestUrl = `lists/getByTitle('${utils_1.formatting.encodeQueryParameter(args.options.listTitle)}')/`;
|
|
30
30
|
}
|
|
31
31
|
else if (args.options.listUrl) {
|
|
32
32
|
const listServerRelativeUrl = utils_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
|
|
33
|
-
listRestUrl = `GetList('${
|
|
33
|
+
listRestUrl = `GetList('${utils_1.formatting.encodeQueryParameter(listServerRelativeUrl)}')/`;
|
|
34
34
|
}
|
|
35
35
|
let fieldRestUrl = '';
|
|
36
36
|
if (args.options.id) {
|
|
37
|
-
fieldRestUrl = `/getbyid('${
|
|
37
|
+
fieldRestUrl = `/getbyid('${utils_1.formatting.encodeQueryParameter(args.options.id)}')`;
|
|
38
38
|
}
|
|
39
39
|
else {
|
|
40
|
-
fieldRestUrl = `/getbyinternalnameortitle('${
|
|
40
|
+
fieldRestUrl = `/getbyinternalnameortitle('${utils_1.formatting.encodeQueryParameter(args.options.fieldTitle)}')`;
|
|
41
41
|
}
|
|
42
42
|
const requestOptions = {
|
|
43
43
|
url: `${args.options.webUrl}/_api/web/${listRestUrl}fields${fieldRestUrl}`,
|
|
@@ -24,14 +24,14 @@ class SpoFieldListCommand extends SpoCommand_1.default {
|
|
|
24
24
|
commandAction(logger, args, cb) {
|
|
25
25
|
let listUrl = '';
|
|
26
26
|
if (args.options.listId) {
|
|
27
|
-
listUrl = `lists(guid'${
|
|
27
|
+
listUrl = `lists(guid'${utils_1.formatting.encodeQueryParameter(args.options.listId)}')/`;
|
|
28
28
|
}
|
|
29
29
|
else if (args.options.listTitle) {
|
|
30
|
-
listUrl = `lists/getByTitle('${
|
|
30
|
+
listUrl = `lists/getByTitle('${utils_1.formatting.encodeQueryParameter(args.options.listTitle)}')/`;
|
|
31
31
|
}
|
|
32
32
|
else if (args.options.listUrl) {
|
|
33
33
|
const listServerRelativeUrl = utils_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
|
|
34
|
-
listUrl = `GetList('${
|
|
34
|
+
listUrl = `GetList('${utils_1.formatting.encodeQueryParameter(listServerRelativeUrl)}')/`;
|
|
35
35
|
}
|
|
36
36
|
const requestOptions = {
|
|
37
37
|
url: `${args.options.webUrl}/_api/web/${listUrl}fields`,
|
|
@@ -37,10 +37,10 @@ class SpoFieldRemoveCommand extends SpoCommand_1.default {
|
|
|
37
37
|
}
|
|
38
38
|
let fieldRestUrl = '';
|
|
39
39
|
if (fieldId) {
|
|
40
|
-
fieldRestUrl = `/getbyid('${
|
|
40
|
+
fieldRestUrl = `/getbyid('${utils_1.formatting.encodeQueryParameter(fieldId)}')`;
|
|
41
41
|
}
|
|
42
42
|
else {
|
|
43
|
-
fieldRestUrl = `/getbyinternalnameortitle('${
|
|
43
|
+
fieldRestUrl = `/getbyinternalnameortitle('${utils_1.formatting.encodeQueryParameter(fieldTitle)}')`;
|
|
44
44
|
}
|
|
45
45
|
const requestOptions = {
|
|
46
46
|
url: `${args.options.webUrl}/_api/web/${listRestUrl}fields${fieldRestUrl}`,
|
|
@@ -57,14 +57,14 @@ class SpoFieldRemoveCommand extends SpoCommand_1.default {
|
|
|
57
57
|
const prepareRemoval = () => {
|
|
58
58
|
let listRestUrl = '';
|
|
59
59
|
if (args.options.listId) {
|
|
60
|
-
listRestUrl = `lists(guid'${
|
|
60
|
+
listRestUrl = `lists(guid'${utils_1.formatting.encodeQueryParameter(args.options.listId)}')/`;
|
|
61
61
|
}
|
|
62
62
|
else if (args.options.listTitle) {
|
|
63
|
-
listRestUrl = `lists/getByTitle('${
|
|
63
|
+
listRestUrl = `lists/getByTitle('${utils_1.formatting.encodeQueryParameter(args.options.listTitle)}')/`;
|
|
64
64
|
}
|
|
65
65
|
else if (args.options.listUrl) {
|
|
66
66
|
const listServerRelativeUrl = utils_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
|
|
67
|
-
listRestUrl = `GetList('${
|
|
67
|
+
listRestUrl = `GetList('${utils_1.formatting.encodeQueryParameter(listServerRelativeUrl)}')/`;
|
|
68
68
|
}
|
|
69
69
|
if (args.options.group) {
|
|
70
70
|
if (this.verbose) {
|
|
@@ -32,7 +32,7 @@ class SpoFileSharinginfoGetCommand extends SpoCommand_1.default {
|
|
|
32
32
|
logger.logToStderr(`Retrieving sharing information report for the file with item Id ${fileInformation.fileItemId}`);
|
|
33
33
|
}
|
|
34
34
|
const requestOptions = {
|
|
35
|
-
url: `${args.options.webUrl}/_api/web/lists/getbytitle('${fileInformation.libraryName}')/items(${fileInformation.fileItemId})/GetSharingInformation?$select=permissionsInformation&$Expand=permissionsInformation`,
|
|
35
|
+
url: `${args.options.webUrl}/_api/web/lists/getbytitle('${utils_1.formatting.encodeQueryParameter(fileInformation.libraryName)}')/items(${fileInformation.fileItemId})/GetSharingInformation?$select=permissionsInformation&$Expand=permissionsInformation`,
|
|
36
36
|
headers: {
|
|
37
37
|
'accept': 'application/json;odata=nometadata'
|
|
38
38
|
},
|
|
@@ -24,15 +24,15 @@ class SpoListContentTypeAddCommand extends SpoCommand_1.default {
|
|
|
24
24
|
}
|
|
25
25
|
commandAction(logger, args, cb) {
|
|
26
26
|
if (this.verbose) {
|
|
27
|
-
const list = args.options.listId ?
|
|
27
|
+
const list = (args.options.listId ? args.options.listId : args.options.listTitle);
|
|
28
28
|
logger.logToStderr(`Adding content type ${args.options.contentTypeId} to list ${list} in site at ${args.options.webUrl}...`);
|
|
29
29
|
}
|
|
30
30
|
let requestUrl = '';
|
|
31
31
|
if (args.options.listId) {
|
|
32
|
-
requestUrl = `${args.options.webUrl}/_api/web/lists(guid'${
|
|
32
|
+
requestUrl = `${args.options.webUrl}/_api/web/lists(guid'${utils_1.formatting.encodeQueryParameter(args.options.listId)}')/ContentTypes/AddAvailableContentType`;
|
|
33
33
|
}
|
|
34
34
|
else {
|
|
35
|
-
requestUrl = `${args.options.webUrl}/_api/web/lists/GetByTitle('${
|
|
35
|
+
requestUrl = `${args.options.webUrl}/_api/web/lists/GetByTitle('${utils_1.formatting.encodeQueryParameter(args.options.listTitle)}')/ContentTypes/AddAvailableContentType`;
|
|
36
36
|
}
|
|
37
37
|
const requestBody = this.mapRequestBody(args.options);
|
|
38
38
|
const requestOptions = {
|
|
@@ -24,8 +24,8 @@ class SpoListContentTypeDefaultSetCommand extends SpoCommand_1.default {
|
|
|
24
24
|
}
|
|
25
25
|
commandAction(logger, args, cb) {
|
|
26
26
|
const baseUrl = args.options.listId ?
|
|
27
|
-
`${args.options.webUrl}/_api/web/lists(guid'${
|
|
28
|
-
`${args.options.webUrl}/_api/web/lists/GetByTitle('${
|
|
27
|
+
`${args.options.webUrl}/_api/web/lists(guid'${utils_1.formatting.encodeQueryParameter(args.options.listId)}')` :
|
|
28
|
+
`${args.options.webUrl}/_api/web/lists/GetByTitle('${utils_1.formatting.encodeQueryParameter(args.options.listTitle)}')`;
|
|
29
29
|
if (this.verbose) {
|
|
30
30
|
logger.logToStderr('Retrieving content type order...');
|
|
31
31
|
}
|
|
@@ -22,15 +22,15 @@ class SpoListContentTypeListCommand extends SpoCommand_1.default {
|
|
|
22
22
|
}
|
|
23
23
|
commandAction(logger, args, cb) {
|
|
24
24
|
if (this.verbose) {
|
|
25
|
-
const list = args.options.listId ?
|
|
25
|
+
const list = (args.options.listId ? args.options.listId : args.options.listTitle);
|
|
26
26
|
logger.logToStderr(`Retrieving content types information for list ${list} in site at ${args.options.webUrl}...`);
|
|
27
27
|
}
|
|
28
28
|
let requestUrl = '';
|
|
29
29
|
if (args.options.listId) {
|
|
30
|
-
requestUrl = `${args.options.webUrl}/_api/web/lists(guid'${
|
|
30
|
+
requestUrl = `${args.options.webUrl}/_api/web/lists(guid'${utils_1.formatting.encodeQueryParameter(args.options.listId)}')/ContentTypes`;
|
|
31
31
|
}
|
|
32
32
|
else {
|
|
33
|
-
requestUrl = `${args.options.webUrl}/_api/web/lists/GetByTitle('${
|
|
33
|
+
requestUrl = `${args.options.webUrl}/_api/web/lists/GetByTitle('${utils_1.formatting.encodeQueryParameter(args.options.listTitle)}')/ContentTypes`;
|
|
34
34
|
}
|
|
35
35
|
const requestOptions = {
|
|
36
36
|
url: requestUrl,
|
|
@@ -27,15 +27,15 @@ class SpoListContentTypeRemoveCommand extends SpoCommand_1.default {
|
|
|
27
27
|
commandAction(logger, args, cb) {
|
|
28
28
|
const removeContentTypeFromList = () => {
|
|
29
29
|
if (this.verbose) {
|
|
30
|
-
const list = args.options.listId ?
|
|
30
|
+
const list = (args.options.listId ? args.options.listId : args.options.listTitle);
|
|
31
31
|
logger.logToStderr(`Removing content type ${args.options.contentTypeId} from list ${list} in site at ${args.options.webUrl}...`);
|
|
32
32
|
}
|
|
33
33
|
let requestUrl = '';
|
|
34
34
|
if (args.options.listId) {
|
|
35
|
-
requestUrl = `${args.options.webUrl}/_api/web/lists(guid'${
|
|
35
|
+
requestUrl = `${args.options.webUrl}/_api/web/lists(guid'${utils_1.formatting.encodeQueryParameter(args.options.listId)}')/ContentTypes('${encodeURIComponent(args.options.contentTypeId)}')`;
|
|
36
36
|
}
|
|
37
37
|
else {
|
|
38
|
-
requestUrl = `${args.options.webUrl}/_api/web/lists/GetByTitle('${
|
|
38
|
+
requestUrl = `${args.options.webUrl}/_api/web/lists/GetByTitle('${utils_1.formatting.encodeQueryParameter(args.options.listTitle)}')/ContentTypes('${encodeURIComponent(args.options.contentTypeId)}')`;
|
|
39
39
|
}
|
|
40
40
|
const requestOptions = {
|
|
41
41
|
url: requestUrl,
|
|
@@ -25,10 +25,10 @@ class SpoListGetCommand extends SpoCommand_1.default {
|
|
|
25
25
|
}
|
|
26
26
|
let requestUrl = '';
|
|
27
27
|
if (args.options.id) {
|
|
28
|
-
requestUrl = `${args.options.webUrl}/_api/web/lists(guid'${
|
|
28
|
+
requestUrl = `${args.options.webUrl}/_api/web/lists(guid'${utils_1.formatting.encodeQueryParameter(args.options.id)}')`;
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
31
|
-
requestUrl = `${args.options.webUrl}/_api/web/lists/GetByTitle('${
|
|
31
|
+
requestUrl = `${args.options.webUrl}/_api/web/lists/GetByTitle('${utils_1.formatting.encodeQueryParameter(args.options.title)}')`;
|
|
32
32
|
}
|
|
33
33
|
let propertiesSelect = args.options.properties ? `?$select=${encodeURIComponent(args.options.properties)}` : ``;
|
|
34
34
|
propertiesSelect += args.options.withPermissions ? `${args.options.properties ? '&' : '?'}$expand=HasUniqueRoleAssignments,RoleAssignments/Member,RoleAssignments/RoleDefinitionBindings` : ``;
|
|
@@ -19,7 +19,7 @@ class SpoListLabelGetCommand extends SpoCommand_1.default {
|
|
|
19
19
|
}
|
|
20
20
|
commandAction(logger, args, cb) {
|
|
21
21
|
if (this.verbose) {
|
|
22
|
-
const list = args.options.listId ?
|
|
22
|
+
const list = (args.options.listId ? args.options.listId : args.options.listTitle);
|
|
23
23
|
logger.logToStderr(`Getting label set on the list ${list} in site at ${args.options.webUrl}...`);
|
|
24
24
|
}
|
|
25
25
|
let requestUrl = '';
|
|
@@ -27,13 +27,13 @@ class SpoListLabelGetCommand extends SpoCommand_1.default {
|
|
|
27
27
|
if (this.debug) {
|
|
28
28
|
logger.logToStderr(`Retrieving List Url from Id '${args.options.listId}'...`);
|
|
29
29
|
}
|
|
30
|
-
requestUrl = `${args.options.webUrl}/_api/web/lists(guid'${
|
|
30
|
+
requestUrl = `${args.options.webUrl}/_api/web/lists(guid'${utils_1.formatting.encodeQueryParameter(args.options.listId)}')?$expand=RootFolder&$select=RootFolder`;
|
|
31
31
|
}
|
|
32
32
|
else {
|
|
33
33
|
if (this.debug) {
|
|
34
34
|
logger.logToStderr(`Retrieving List Url from Title '${args.options.listTitle}'...`);
|
|
35
35
|
}
|
|
36
|
-
requestUrl = `${args.options.webUrl}/_api/web/lists/GetByTitle('${
|
|
36
|
+
requestUrl = `${args.options.webUrl}/_api/web/lists/GetByTitle('${utils_1.formatting.encodeQueryParameter(args.options.listTitle)}')?$expand=RootFolder&$select=RootFolder`;
|
|
37
37
|
}
|
|
38
38
|
const requestOptions = {
|
|
39
39
|
url: requestUrl,
|
|
@@ -29,10 +29,10 @@ class SpoListLabelSetCommand extends SpoCommand_1.default {
|
|
|
29
29
|
return Promise.resolve(listServerRelativeUrl);
|
|
30
30
|
}
|
|
31
31
|
else if (args.options.listId) {
|
|
32
|
-
listRestUrl = `lists(guid'${
|
|
32
|
+
listRestUrl = `lists(guid'${utils_1.formatting.encodeQueryParameter(args.options.listId)}')/`;
|
|
33
33
|
}
|
|
34
34
|
else {
|
|
35
|
-
listRestUrl = `lists/getByTitle('${
|
|
35
|
+
listRestUrl = `lists/getByTitle('${utils_1.formatting.encodeQueryParameter(args.options.listTitle)}')/`;
|
|
36
36
|
}
|
|
37
37
|
const requestOptions = {
|
|
38
38
|
url: `${args.options.webUrl}/_api/web/${listRestUrl}?$expand=RootFolder&$select=RootFolder`,
|
|
@@ -26,10 +26,10 @@ class SpoListRemoveCommand extends SpoCommand_1.default {
|
|
|
26
26
|
}
|
|
27
27
|
let requestUrl = '';
|
|
28
28
|
if (args.options.id) {
|
|
29
|
-
requestUrl = `${args.options.webUrl}/_api/web/lists(guid'${
|
|
29
|
+
requestUrl = `${args.options.webUrl}/_api/web/lists(guid'${utils_1.formatting.encodeQueryParameter(args.options.id)}')`;
|
|
30
30
|
}
|
|
31
31
|
else {
|
|
32
|
-
requestUrl = `${args.options.webUrl}/_api/web/lists/GetByTitle('${
|
|
32
|
+
requestUrl = `${args.options.webUrl}/_api/web/lists/GetByTitle('${utils_1.formatting.encodeQueryParameter(args.options.title)}')`;
|
|
33
33
|
}
|
|
34
34
|
const requestOptions = {
|
|
35
35
|
url: requestUrl,
|
|
@@ -29,10 +29,10 @@ class SpoListRoleInheritanceBreakCommand extends SpoCommand_1.default {
|
|
|
29
29
|
}
|
|
30
30
|
let requestUrl = `${args.options.webUrl}/_api/web/lists`;
|
|
31
31
|
if (args.options.listId) {
|
|
32
|
-
requestUrl += `(guid'${
|
|
32
|
+
requestUrl += `(guid'${utils_1.formatting.encodeQueryParameter(args.options.listId)}')`;
|
|
33
33
|
}
|
|
34
34
|
else {
|
|
35
|
-
requestUrl += `/getbytitle('${
|
|
35
|
+
requestUrl += `/getbytitle('${utils_1.formatting.encodeQueryParameter(args.options.listTitle)}')`;
|
|
36
36
|
}
|
|
37
37
|
let keepExistingPermissions = true;
|
|
38
38
|
if (args.options.clearExistingPermissions) {
|
|
@@ -28,10 +28,10 @@ class SpoListRoleInheritanceResetCommand extends SpoCommand_1.default {
|
|
|
28
28
|
}
|
|
29
29
|
let requestUrl = `${args.options.webUrl}/_api/web/lists`;
|
|
30
30
|
if (args.options.listId) {
|
|
31
|
-
requestUrl += `(guid'${
|
|
31
|
+
requestUrl += `(guid'${utils_1.formatting.encodeQueryParameter(args.options.listId)}')`;
|
|
32
32
|
}
|
|
33
33
|
else {
|
|
34
|
-
requestUrl += `/getbytitle('${
|
|
34
|
+
requestUrl += `/getbytitle('${utils_1.formatting.encodeQueryParameter(args.options.listTitle)}')`;
|
|
35
35
|
}
|
|
36
36
|
const requestOptions = {
|
|
37
37
|
url: `${requestUrl}/resetroleinheritance`,
|
|
@@ -20,7 +20,7 @@ class SpoListSiteScriptGetCommand extends SpoCommand_1.default {
|
|
|
20
20
|
}
|
|
21
21
|
commandAction(logger, args, cb) {
|
|
22
22
|
if (this.verbose) {
|
|
23
|
-
const list = args.options.listId ?
|
|
23
|
+
const list = (args.options.listId ? args.options.listId : args.options.listTitle);
|
|
24
24
|
logger.logToStderr(`Extracting Site Script from list ${list} in site at ${args.options.webUrl}...`);
|
|
25
25
|
}
|
|
26
26
|
let requestUrl = '';
|
|
@@ -28,13 +28,13 @@ class SpoListSiteScriptGetCommand extends SpoCommand_1.default {
|
|
|
28
28
|
if (this.debug) {
|
|
29
29
|
logger.logToStderr(`Retrieving List Url from Id '${args.options.listId}'...`);
|
|
30
30
|
}
|
|
31
|
-
requestUrl = `${args.options.webUrl}/_api/web/lists(guid'${
|
|
31
|
+
requestUrl = `${args.options.webUrl}/_api/web/lists(guid'${utils_1.formatting.encodeQueryParameter(args.options.listId)}')?$expand=RootFolder`;
|
|
32
32
|
}
|
|
33
33
|
else {
|
|
34
34
|
if (this.debug) {
|
|
35
35
|
logger.logToStderr(`Retrieving List Url from Title '${args.options.listTitle}'...`);
|
|
36
36
|
}
|
|
37
|
-
requestUrl = `${args.options.webUrl}/_api/web/lists/GetByTitle('${
|
|
37
|
+
requestUrl = `${args.options.webUrl}/_api/web/lists/GetByTitle('${utils_1.formatting.encodeQueryParameter(args.options.listTitle)}')?$expand=RootFolder`;
|
|
38
38
|
}
|
|
39
39
|
const requestOptions = {
|
|
40
40
|
url: requestUrl,
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("../../../../utils");
|
|
4
|
+
const request_1 = require("../../../../request");
|
|
5
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
6
|
+
const commands_1 = require("../../commands");
|
|
7
|
+
class SpoListViewAddCommand extends SpoCommand_1.default {
|
|
8
|
+
get name() {
|
|
9
|
+
return commands_1.default.LIST_VIEW_ADD;
|
|
10
|
+
}
|
|
11
|
+
get description() {
|
|
12
|
+
return 'Adds a new view to a SharePoint list.';
|
|
13
|
+
}
|
|
14
|
+
getTelemetryProperties(args) {
|
|
15
|
+
const telemetryProps = super.getTelemetryProperties(args);
|
|
16
|
+
telemetryProps.listId = typeof args.options.listId !== 'undefined';
|
|
17
|
+
telemetryProps.listTitle = typeof args.options.listTitle !== 'undefined';
|
|
18
|
+
telemetryProps.listUrl = typeof args.options.listUrl !== 'undefined';
|
|
19
|
+
telemetryProps.title = typeof args.options.title !== 'undefined';
|
|
20
|
+
telemetryProps.viewQuery = typeof args.options.viewQuery !== 'undefined';
|
|
21
|
+
telemetryProps.personal = !!args.options.personal;
|
|
22
|
+
telemetryProps.default = !!args.options.default;
|
|
23
|
+
telemetryProps.orderedView = !!args.options.orderedView;
|
|
24
|
+
telemetryProps.paged = !!args.options.paged;
|
|
25
|
+
telemetryProps.rowLimit = typeof args.options.rowLimit !== 'undefined';
|
|
26
|
+
return telemetryProps;
|
|
27
|
+
}
|
|
28
|
+
commandAction(logger, args, cb) {
|
|
29
|
+
const requestOptions = {
|
|
30
|
+
url: this.getRestUrl(args.options),
|
|
31
|
+
headers: {
|
|
32
|
+
'content-type': 'application/json;odata=verbose',
|
|
33
|
+
accept: 'application/json;odata=nometadata'
|
|
34
|
+
},
|
|
35
|
+
responseType: 'json',
|
|
36
|
+
data: {
|
|
37
|
+
parameters: {
|
|
38
|
+
Title: args.options.title,
|
|
39
|
+
ViewFields: {
|
|
40
|
+
results: args.options.fields.split(',')
|
|
41
|
+
},
|
|
42
|
+
Query: args.options.viewQuery,
|
|
43
|
+
PersonalView: !!args.options.personal,
|
|
44
|
+
SetAsDefaultView: !!args.options.default,
|
|
45
|
+
Paged: !!args.options.paged,
|
|
46
|
+
RowLimit: args.options.rowLimit ? +args.options.rowLimit : 30
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
request_1.default
|
|
51
|
+
.post(requestOptions)
|
|
52
|
+
.then((result) => {
|
|
53
|
+
logger.log(result);
|
|
54
|
+
cb();
|
|
55
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
56
|
+
}
|
|
57
|
+
getRestUrl(options) {
|
|
58
|
+
let result = `${options.webUrl}/_api/web/`;
|
|
59
|
+
if (options.listId) {
|
|
60
|
+
result += `lists(guid'${utils_1.formatting.encodeQueryParameter(options.listId)}')`;
|
|
61
|
+
}
|
|
62
|
+
else if (options.listTitle) {
|
|
63
|
+
result += `lists/getByTitle('${utils_1.formatting.encodeQueryParameter(options.listTitle)}')`;
|
|
64
|
+
}
|
|
65
|
+
else if (options.listUrl) {
|
|
66
|
+
result += `GetList('${utils_1.formatting.encodeQueryParameter(utils_1.urlUtil.getServerRelativePath(options.webUrl, options.listUrl))}')`;
|
|
67
|
+
}
|
|
68
|
+
result += '/views/add';
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
optionSets() {
|
|
72
|
+
return [
|
|
73
|
+
['listId', 'listTitle', 'listUrl']
|
|
74
|
+
];
|
|
75
|
+
}
|
|
76
|
+
options() {
|
|
77
|
+
const options = [
|
|
78
|
+
{ option: '-u, --webUrl <webUrl>' },
|
|
79
|
+
{ option: '--listId [listId]' },
|
|
80
|
+
{ option: '--listTitle [listTitle]' },
|
|
81
|
+
{ option: '--listUrl [listUrl]' },
|
|
82
|
+
{ option: '--title <title>' },
|
|
83
|
+
{ option: '--fields <fields>' },
|
|
84
|
+
{ option: '--viewQuery [viewQuery]' },
|
|
85
|
+
{ option: '--personal' },
|
|
86
|
+
{ option: '--default' },
|
|
87
|
+
{ option: '--paged' },
|
|
88
|
+
{ option: '--rowLimit [rowLimit]' }
|
|
89
|
+
];
|
|
90
|
+
const parentOptions = super.options();
|
|
91
|
+
return options.concat(parentOptions);
|
|
92
|
+
}
|
|
93
|
+
validate(args) {
|
|
94
|
+
const webUrlValidation = utils_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
95
|
+
if (webUrlValidation !== true) {
|
|
96
|
+
return webUrlValidation;
|
|
97
|
+
}
|
|
98
|
+
if (args.options.listId && !utils_1.validation.isValidGuid(args.options.listId)) {
|
|
99
|
+
return `${args.options.listId} in option listId is not a valid GUID`;
|
|
100
|
+
}
|
|
101
|
+
if (args.options.rowLimit !== undefined) {
|
|
102
|
+
if (isNaN(args.options.rowLimit)) {
|
|
103
|
+
return `${args.options.rowLimit} is not a number`;
|
|
104
|
+
}
|
|
105
|
+
if (+args.options.rowLimit <= 0) {
|
|
106
|
+
return 'rowLimit option must be greater than 0.';
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (args.options.personal && args.options.default) {
|
|
110
|
+
return 'Default view cannot be a personal view.';
|
|
111
|
+
}
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
module.exports = new SpoListViewAddCommand();
|
|
116
|
+
//# sourceMappingURL=list-view-add.js.map
|
|
@@ -23,7 +23,7 @@ class SpoListViewFieldAddCommand extends SpoCommand_1.default {
|
|
|
23
23
|
return telemetryProps;
|
|
24
24
|
}
|
|
25
25
|
commandAction(logger, args, cb) {
|
|
26
|
-
const listSelector = args.options.listId ? `(guid'${
|
|
26
|
+
const listSelector = args.options.listId ? `(guid'${utils_1.formatting.encodeQueryParameter(args.options.listId)}')` : `/GetByTitle('${utils_1.formatting.encodeQueryParameter(args.options.listTitle)}')`;
|
|
27
27
|
let viewSelector = '';
|
|
28
28
|
let currentField;
|
|
29
29
|
if (this.verbose) {
|
|
@@ -36,7 +36,7 @@ class SpoListViewFieldAddCommand extends SpoCommand_1.default {
|
|
|
36
36
|
logger.logToStderr(`Adding the field ${args.options.fieldId || args.options.fieldTitle} to the view ${args.options.viewId || args.options.viewTitle}...`);
|
|
37
37
|
}
|
|
38
38
|
currentField = field;
|
|
39
|
-
viewSelector = args.options.viewId ? `('${
|
|
39
|
+
viewSelector = args.options.viewId ? `('${utils_1.formatting.encodeQueryParameter(args.options.viewId)}')` : `/GetByTitle('${utils_1.formatting.encodeQueryParameter(args.options.viewTitle)}')`;
|
|
40
40
|
const postRequestUrl = `${args.options.webUrl}/_api/web/lists${listSelector}/views${viewSelector}/viewfields/addviewfield('${field.InternalName}')`;
|
|
41
41
|
const postRequestOptions = {
|
|
42
42
|
url: postRequestUrl,
|
|
@@ -24,7 +24,7 @@ class SpoListViewFieldRemoveCommand extends SpoCommand_1.default {
|
|
|
24
24
|
return telemetryProps;
|
|
25
25
|
}
|
|
26
26
|
commandAction(logger, args, cb) {
|
|
27
|
-
const listSelector = args.options.listId ? `(guid'${
|
|
27
|
+
const listSelector = args.options.listId ? `(guid'${utils_1.formatting.encodeQueryParameter(args.options.listId)}')` : `/GetByTitle('${utils_1.formatting.encodeQueryParameter(args.options.listTitle)}')`;
|
|
28
28
|
const removeFieldFromView = () => {
|
|
29
29
|
if (this.verbose) {
|
|
30
30
|
logger.logToStderr(`Getting field ${args.options.fieldId || args.options.fieldTitle}...`);
|
|
@@ -35,7 +35,7 @@ class SpoListViewFieldRemoveCommand extends SpoCommand_1.default {
|
|
|
35
35
|
if (this.verbose) {
|
|
36
36
|
logger.logToStderr(`Removing field ${args.options.fieldId || args.options.fieldTitle} from view ${args.options.viewId || args.options.viewTitle}...`);
|
|
37
37
|
}
|
|
38
|
-
const viewSelector = args.options.viewId ? `('${
|
|
38
|
+
const viewSelector = args.options.viewId ? `('${utils_1.formatting.encodeQueryParameter(args.options.viewId)}')` : `/GetByTitle('${utils_1.formatting.encodeQueryParameter(args.options.viewTitle)}')`;
|
|
39
39
|
const postRequestUrl = `${args.options.webUrl}/_api/web/lists${listSelector}/views${viewSelector}/viewfields/removeviewfield('${field.InternalName}')`;
|
|
40
40
|
const postRequestOptions = {
|
|
41
41
|
url: postRequestUrl,
|
|
@@ -22,8 +22,8 @@ class SpoListViewFieldSetCommand extends SpoCommand_1.default {
|
|
|
22
22
|
return telemetryProps;
|
|
23
23
|
}
|
|
24
24
|
commandAction(logger, args, cb) {
|
|
25
|
-
const listSelector = args.options.listId ? `(guid'${
|
|
26
|
-
const viewSelector = args.options.viewId ? `('${
|
|
25
|
+
const listSelector = args.options.listId ? `(guid'${utils_1.formatting.encodeQueryParameter(args.options.listId)}')` : `/GetByTitle('${utils_1.formatting.encodeQueryParameter(args.options.listTitle)}')`;
|
|
26
|
+
const viewSelector = args.options.viewId ? `('${utils_1.formatting.encodeQueryParameter(args.options.viewId)}')` : `/GetByTitle('${utils_1.formatting.encodeQueryParameter(args.options.viewTitle)}')`;
|
|
27
27
|
if (this.verbose) {
|
|
28
28
|
logger.logToStderr(`Getting field ${args.options.fieldId || args.options.fieldTitle}...`);
|
|
29
29
|
}
|
|
@@ -24,16 +24,16 @@ class SpoListViewGetCommand extends SpoCommand_1.default {
|
|
|
24
24
|
const baseRestUrl = `${args.options.webUrl}/_api/web`;
|
|
25
25
|
let listRestUrl = '';
|
|
26
26
|
if (args.options.listId) {
|
|
27
|
-
listRestUrl = `/lists(guid'${
|
|
27
|
+
listRestUrl = `/lists(guid'${utils_1.formatting.encodeQueryParameter(args.options.listId)}')`;
|
|
28
28
|
}
|
|
29
29
|
else if (args.options.listTitle) {
|
|
30
|
-
listRestUrl = `/lists/getByTitle('${
|
|
30
|
+
listRestUrl = `/lists/getByTitle('${utils_1.formatting.encodeQueryParameter(args.options.listTitle)}')`;
|
|
31
31
|
}
|
|
32
32
|
else if (args.options.listUrl) {
|
|
33
33
|
const listServerRelativeUrl = utils_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
|
|
34
|
-
listRestUrl = `/GetList('${
|
|
34
|
+
listRestUrl = `/GetList('${utils_1.formatting.encodeQueryParameter(listServerRelativeUrl)}')`;
|
|
35
35
|
}
|
|
36
|
-
const viewRestUrl = `/views/${(args.options.viewId ? `getById('${
|
|
36
|
+
const viewRestUrl = `/views/${(args.options.viewId ? `getById('${utils_1.formatting.encodeQueryParameter(args.options.viewId)}')` : `getByTitle('${utils_1.formatting.encodeQueryParameter(args.options.viewTitle)}')`)}`;
|
|
37
37
|
const requestOptions = {
|
|
38
38
|
url: `${baseRestUrl}${listRestUrl}${viewRestUrl}`,
|
|
39
39
|
headers: {
|
|
@@ -22,15 +22,15 @@ class SpoListViewListCommand extends SpoCommand_1.default {
|
|
|
22
22
|
}
|
|
23
23
|
commandAction(logger, args, cb) {
|
|
24
24
|
if (this.verbose) {
|
|
25
|
-
const list = args.options.listId ?
|
|
25
|
+
const list = (args.options.listId ? args.options.listId : args.options.listTitle);
|
|
26
26
|
logger.logToStderr(`Retrieving views information for list ${list} in site at ${args.options.webUrl}...`);
|
|
27
27
|
}
|
|
28
28
|
let requestUrl = '';
|
|
29
29
|
if (args.options.listId) {
|
|
30
|
-
requestUrl = `${args.options.webUrl}/_api/web/lists(guid'${
|
|
30
|
+
requestUrl = `${args.options.webUrl}/_api/web/lists(guid'${utils_1.formatting.encodeQueryParameter(args.options.listId)}')/views`;
|
|
31
31
|
}
|
|
32
32
|
else {
|
|
33
|
-
requestUrl = `${args.options.webUrl}/_api/web/lists/GetByTitle('${
|
|
33
|
+
requestUrl = `${args.options.webUrl}/_api/web/lists/GetByTitle('${utils_1.formatting.encodeQueryParameter(args.options.listTitle)}')/views`;
|
|
34
34
|
}
|
|
35
35
|
const requestOptions = {
|
|
36
36
|
url: requestUrl,
|