@pnp/cli-microsoft365 5.3.0 → 5.4.0-beta.1051e37
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/.eslintrc.js +1 -0
- package/dist/m365/aad/commands/app/app-set.js +4 -1
- package/dist/m365/aad/commands/o365group/o365group-conversation-post-list.js +4 -19
- package/dist/m365/aad/commands/o365group/o365group-get.js +3 -9
- package/dist/m365/base/PlannerCommand.js +10 -0
- package/dist/m365/flow/commands/flow-export.js +3 -3
- package/dist/m365/planner/commands/bucket/bucket-add.js +4 -16
- package/dist/m365/planner/commands/bucket/bucket-get.js +5 -19
- package/dist/m365/planner/commands/bucket/bucket-list.js +4 -17
- package/dist/m365/planner/commands/bucket/bucket-remove.js +6 -20
- package/dist/m365/planner/commands/bucket/bucket-set.js +5 -19
- package/dist/m365/planner/commands/plan/plan-add.js +4 -16
- package/dist/m365/planner/commands/plan/plan-details-get.js +4 -19
- package/dist/m365/planner/commands/plan/plan-get.js +4 -17
- package/dist/m365/planner/commands/plan/plan-list.js +4 -17
- package/dist/m365/planner/commands/task/task-add.js +4 -16
- package/dist/m365/planner/commands/task/task-checklistitem-add.js +89 -0
- package/dist/m365/planner/commands/task/task-get.js +61 -34
- package/dist/m365/planner/commands/task/task-list.js +4 -16
- package/dist/m365/planner/commands/task/task-remove.js +201 -0
- package/dist/m365/planner/commands/task/task-set.js +4 -16
- package/dist/m365/planner/commands/tenant/tenant-settings-list.js +33 -0
- package/dist/m365/planner/commands.js +5 -2
- 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 +3 -3
- package/dist/m365/spo/commands/eventreceiver/eventreceiver-list.js +102 -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-list.js +10 -1
- 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 +6 -3
- 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 +31 -11
- 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/roledefinition/roledefinition-remove.js +82 -0
- package/dist/m365/spo/commands/site/site-remove.js +23 -37
- package/dist/m365/spo/commands.js +2 -0
- package/dist/m365/teams/commands/app/app-list.js +6 -20
- package/dist/m365/teams/commands/channel/channel-get.js +6 -19
- package/dist/m365/teams/commands/channel/channel-list.js +6 -18
- package/dist/m365/teams/commands/channel/channel-member-add.js +7 -18
- package/dist/m365/teams/commands/channel/channel-member-list.js +6 -19
- package/dist/m365/teams/commands/channel/channel-member-remove.js +6 -19
- package/dist/m365/teams/commands/channel/channel-member-set.js +6 -19
- package/dist/m365/teams/commands/tab/tab-get.js +6 -19
- package/dist/m365/teams/commands/team/team-add.js +2 -7
- package/dist/m365/teams/commands/team/team-get.js +6 -19
- package/dist/utils/aadGroup.js +57 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/validation.js +12 -2
- package/docs/docs/cmd/aad/app/app-set.md +1 -1
- package/docs/docs/cmd/file/file-list.md +4 -4
- 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-checklistitem-add.md +36 -0
- package/docs/docs/cmd/planner/task/task-get.md +7 -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/planner/tenant/tenant-settings-list.md +28 -0
- package/docs/docs/cmd/spfx/project/project-upgrade.md +1 -1
- package/docs/docs/cmd/spo/eventreceiver/eventreceiver-list.md +64 -0
- package/docs/docs/cmd/spo/file/file-checkout.md +1 -1
- package/docs/docs/cmd/spo/list/list-list.md +3 -0
- package/docs/docs/cmd/spo/list/list-view-add.md +13 -4
- package/docs/docs/cmd/spo/listitem/listitem-list.md +16 -10
- package/docs/docs/cmd/spo/listitem/listitem-roleinheritance-break.md +2 -2
- package/docs/docs/cmd/spo/roledefinition/roledefinition-remove.md +36 -0
- package/npm-shrinkwrap.json +257 -1104
- package/package.json +25 -21
- package/dist/m365/planner/commands/task/task-details-get.js +0 -45
- package/docs/docs/cmd/planner/task/task-details-get.md +0 -24
|
@@ -17,6 +17,7 @@ class SpoListViewAddCommand extends SpoCommand_1.default {
|
|
|
17
17
|
telemetryProps.listTitle = typeof args.options.listTitle !== 'undefined';
|
|
18
18
|
telemetryProps.listUrl = typeof args.options.listUrl !== 'undefined';
|
|
19
19
|
telemetryProps.title = typeof args.options.title !== 'undefined';
|
|
20
|
+
telemetryProps.viewQuery = typeof args.options.viewQuery !== 'undefined';
|
|
20
21
|
telemetryProps.personal = !!args.options.personal;
|
|
21
22
|
telemetryProps.default = !!args.options.default;
|
|
22
23
|
telemetryProps.orderedView = !!args.options.orderedView;
|
|
@@ -38,6 +39,7 @@ class SpoListViewAddCommand extends SpoCommand_1.default {
|
|
|
38
39
|
ViewFields: {
|
|
39
40
|
results: args.options.fields.split(',')
|
|
40
41
|
},
|
|
42
|
+
Query: args.options.viewQuery,
|
|
41
43
|
PersonalView: !!args.options.personal,
|
|
42
44
|
SetAsDefaultView: !!args.options.default,
|
|
43
45
|
Paged: !!args.options.paged,
|
|
@@ -55,13 +57,13 @@ class SpoListViewAddCommand extends SpoCommand_1.default {
|
|
|
55
57
|
getRestUrl(options) {
|
|
56
58
|
let result = `${options.webUrl}/_api/web/`;
|
|
57
59
|
if (options.listId) {
|
|
58
|
-
result += `lists(guid'${
|
|
60
|
+
result += `lists(guid'${utils_1.formatting.encodeQueryParameter(options.listId)}')`;
|
|
59
61
|
}
|
|
60
62
|
else if (options.listTitle) {
|
|
61
|
-
result += `lists/getByTitle('${
|
|
63
|
+
result += `lists/getByTitle('${utils_1.formatting.encodeQueryParameter(options.listTitle)}')`;
|
|
62
64
|
}
|
|
63
65
|
else if (options.listUrl) {
|
|
64
|
-
result += `GetList('${
|
|
66
|
+
result += `GetList('${utils_1.formatting.encodeQueryParameter(utils_1.urlUtil.getServerRelativePath(options.webUrl, options.listUrl))}')`;
|
|
65
67
|
}
|
|
66
68
|
result += '/views/add';
|
|
67
69
|
return result;
|
|
@@ -79,6 +81,7 @@ class SpoListViewAddCommand extends SpoCommand_1.default {
|
|
|
79
81
|
{ option: '--listUrl [listUrl]' },
|
|
80
82
|
{ option: '--title <title>' },
|
|
81
83
|
{ option: '--fields <fields>' },
|
|
84
|
+
{ option: '--viewQuery [viewQuery]' },
|
|
82
85
|
{ option: '--personal' },
|
|
83
86
|
{ option: '--default' },
|
|
84
87
|
{ option: '--paged' },
|
|
@@ -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,
|
|
@@ -24,12 +24,12 @@ class SpoListViewRemoveCommand extends SpoCommand_1.default {
|
|
|
24
24
|
commandAction(logger, args, cb) {
|
|
25
25
|
const removeViewFromList = () => {
|
|
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(`Removing view ${args.options.viewId || args.options.viewTitle} from list ${list} in site at ${args.options.webUrl}...`);
|
|
29
29
|
}
|
|
30
30
|
let requestUrl = '';
|
|
31
|
-
const listSelector = args.options.listId ? `(guid'${
|
|
32
|
-
const viewSelector = args.options.viewId ? `(guid'${
|
|
31
|
+
const listSelector = args.options.listId ? `(guid'${utils_1.formatting.encodeQueryParameter(args.options.listId)}')` : `/GetByTitle('${utils_1.formatting.encodeQueryParameter(args.options.listTitle)}')`;
|
|
32
|
+
const viewSelector = args.options.viewId ? `(guid'${utils_1.formatting.encodeQueryParameter(args.options.viewId)}')` : `/GetByTitle('${utils_1.formatting.encodeQueryParameter(args.options.viewTitle)}')`;
|
|
33
33
|
requestUrl = `${args.options.webUrl}/_api/web/lists${listSelector}/views${viewSelector}`;
|
|
34
34
|
const requestOptions = {
|
|
35
35
|
url: requestUrl,
|
|
@@ -25,9 +25,9 @@ class SpoListViewSetCommand extends SpoCommand_1.default {
|
|
|
25
25
|
commandAction(logger, args, cb) {
|
|
26
26
|
const baseRestUrl = `${args.options.webUrl}/_api/web/lists`;
|
|
27
27
|
const listRestUrl = args.options.listId ?
|
|
28
|
-
`(guid'${
|
|
29
|
-
: `/getByTitle('${
|
|
30
|
-
const viewRestUrl = `/views/${(args.options.viewId ? `getById('${
|
|
28
|
+
`(guid'${utils_1.formatting.encodeQueryParameter(args.options.listId)}')`
|
|
29
|
+
: `/getByTitle('${utils_1.formatting.encodeQueryParameter(args.options.listTitle)}')`;
|
|
30
|
+
const viewRestUrl = `/views/${(args.options.viewId ? `getById('${utils_1.formatting.encodeQueryParameter(args.options.viewId)}')` : `getByTitle('${utils_1.formatting.encodeQueryParameter(args.options.viewTitle)}')`)}`;
|
|
31
31
|
utils_1.spo
|
|
32
32
|
.getRequestDigest(args.options.webUrl)
|
|
33
33
|
.then((res) => {
|
|
@@ -25,14 +25,14 @@ class SpoListWebhookAddCommand extends SpoCommand_1.default {
|
|
|
25
25
|
}
|
|
26
26
|
commandAction(logger, args, cb) {
|
|
27
27
|
if (this.verbose) {
|
|
28
|
-
logger.logToStderr(`Adding webhook to list ${args.options.listId ?
|
|
28
|
+
logger.logToStderr(`Adding webhook to list ${args.options.listId ? args.options.listId : args.options.listTitle} located at site ${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)}')/Subscriptions')`;
|
|
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)}')/Subscriptions')`;
|
|
36
36
|
}
|
|
37
37
|
const requestBody = {};
|
|
38
38
|
requestBody.resource = args.options.listId ? args.options.listId : args.options.listTitle;
|
|
@@ -20,15 +20,15 @@ class SpoListWebhookGetCommand 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(`Retrieving information for webhook ${args.options.id} belonging to list ${list} in site at ${args.options.webUrl}...`);
|
|
25
25
|
}
|
|
26
26
|
let requestUrl = '';
|
|
27
27
|
if (args.options.listId) {
|
|
28
|
-
requestUrl = `${args.options.webUrl}/_api/web/lists(guid'${
|
|
28
|
+
requestUrl = `${args.options.webUrl}/_api/web/lists(guid'${utils_1.formatting.encodeQueryParameter(args.options.listId)}')/Subscriptions('${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.listTitle)}')/Subscriptions('${utils_1.formatting.encodeQueryParameter(args.options.id)}')`;
|
|
32
32
|
}
|
|
33
33
|
const requestOptions = {
|
|
34
34
|
url: requestUrl,
|
|
@@ -31,21 +31,21 @@ class SpoListWebhookListCommand extends SpoCommand_1.default {
|
|
|
31
31
|
logger.logToStderr(chalk.yellow(`Option 'id' is deprecated. Please use 'listId' instead`));
|
|
32
32
|
}
|
|
33
33
|
if (this.verbose) {
|
|
34
|
-
const list = args.options.id ?
|
|
34
|
+
const list = args.options.id ? utils_1.formatting.encodeQueryParameter(args.options.id) : (args.options.listId ? utils_1.formatting.encodeQueryParameter(args.options.listId) : (args.options.title ? utils_1.formatting.encodeQueryParameter(args.options.title) : utils_1.formatting.encodeQueryParameter(args.options.listTitle)));
|
|
35
35
|
logger.logToStderr(`Retrieving webhook information for list ${list} in site at ${args.options.webUrl}...`);
|
|
36
36
|
}
|
|
37
37
|
let requestUrl = '';
|
|
38
38
|
if (args.options.id) {
|
|
39
|
-
requestUrl = `${args.options.webUrl}/_api/web/lists(guid'${
|
|
39
|
+
requestUrl = `${args.options.webUrl}/_api/web/lists(guid'${utils_1.formatting.encodeQueryParameter(args.options.id)}')/Subscriptions`;
|
|
40
40
|
}
|
|
41
41
|
else if (args.options.listId) {
|
|
42
|
-
requestUrl = `${args.options.webUrl}/_api/web/lists(guid'${
|
|
42
|
+
requestUrl = `${args.options.webUrl}/_api/web/lists(guid'${utils_1.formatting.encodeQueryParameter(args.options.listId)}')/Subscriptions`;
|
|
43
43
|
}
|
|
44
44
|
else if (args.options.listTitle) {
|
|
45
|
-
requestUrl = `${args.options.webUrl}/_api/web/lists/GetByTitle('${
|
|
45
|
+
requestUrl = `${args.options.webUrl}/_api/web/lists/GetByTitle('${utils_1.formatting.encodeQueryParameter(args.options.listTitle)}')/Subscriptions`;
|
|
46
46
|
}
|
|
47
47
|
else {
|
|
48
|
-
requestUrl = `${args.options.webUrl}/_api/web/lists/GetByTitle('${
|
|
48
|
+
requestUrl = `${args.options.webUrl}/_api/web/lists/GetByTitle('${utils_1.formatting.encodeQueryParameter(args.options.title)}')/Subscriptions`;
|
|
49
49
|
}
|
|
50
50
|
const requestOptions = {
|
|
51
51
|
url: requestUrl,
|
|
@@ -21,17 +21,17 @@ class SpoListWebhookRemoveCommand extends SpoCommand_1.default {
|
|
|
21
21
|
return telemetryProps;
|
|
22
22
|
}
|
|
23
23
|
commandAction(logger, args, cb) {
|
|
24
|
-
const list = args.options.listId ? encodeURIComponent(args.options.listId) : encodeURIComponent(args.options.listTitle);
|
|
25
24
|
const removeWebhook = () => {
|
|
26
25
|
if (this.verbose) {
|
|
26
|
+
const list = (args.options.listId ? args.options.listId : args.options.listTitle);
|
|
27
27
|
logger.logToStderr(`Webhook ${args.options.id} is about to be removed from list ${list} located at site ${args.options.webUrl}...`);
|
|
28
28
|
}
|
|
29
29
|
let requestUrl = '';
|
|
30
30
|
if (args.options.listId) {
|
|
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)}')/Subscriptions('${utils_1.formatting.encodeQueryParameter(args.options.id)}')`;
|
|
32
32
|
}
|
|
33
33
|
else {
|
|
34
|
-
requestUrl = `${args.options.webUrl}/_api/web/lists/GetByTitle('${
|
|
34
|
+
requestUrl = `${args.options.webUrl}/_api/web/lists/GetByTitle('${utils_1.formatting.encodeQueryParameter(args.options.listTitle)}')/Subscriptions('${utils_1.formatting.encodeQueryParameter(args.options.id)}')`;
|
|
35
35
|
}
|
|
36
36
|
const requestOptions = {
|
|
37
37
|
url: requestUrl,
|
|
@@ -58,7 +58,7 @@ class SpoListWebhookRemoveCommand extends SpoCommand_1.default {
|
|
|
58
58
|
type: 'confirm',
|
|
59
59
|
name: 'continue',
|
|
60
60
|
default: false,
|
|
61
|
-
message: `Are you sure you want to remove webhook ${args.options.id} from list ${
|
|
61
|
+
message: `Are you sure you want to remove webhook ${args.options.id} from list ${args.options.listTitle || args.options.listId} located at site ${args.options.webUrl}?`
|
|
62
62
|
}, (result) => {
|
|
63
63
|
if (!result.continue) {
|
|
64
64
|
cb();
|
|
@@ -22,14 +22,14 @@ class SpoListWebhookSetCommand extends SpoCommand_1.default {
|
|
|
22
22
|
}
|
|
23
23
|
commandAction(logger, args, cb) {
|
|
24
24
|
if (this.verbose) {
|
|
25
|
-
logger.logToStderr(`Updating webhook ${args.options.id} belonging to list ${args.options.listId ?
|
|
25
|
+
logger.logToStderr(`Updating webhook ${args.options.id} belonging to list ${args.options.listId ? args.options.listId : args.options.listTitle} located at site ${args.options.webUrl}...`);
|
|
26
26
|
}
|
|
27
27
|
let requestUrl = '';
|
|
28
28
|
if (args.options.listId) {
|
|
29
|
-
requestUrl = `${args.options.webUrl}/_api/web/lists(guid'${
|
|
29
|
+
requestUrl = `${args.options.webUrl}/_api/web/lists(guid'${utils_1.formatting.encodeQueryParameter(args.options.listId)}')/Subscriptions('${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.listTitle)}')/Subscriptions('${utils_1.formatting.encodeQueryParameter(args.options.id)}')`;
|
|
33
33
|
}
|
|
34
34
|
const requestBody = {};
|
|
35
35
|
if (args.options.notificationUrl) {
|
|
@@ -26,8 +26,8 @@ class SpoListItemAddCommand extends SpoCommand_1.default {
|
|
|
26
26
|
const listIdArgument = args.options.listId || '';
|
|
27
27
|
const listTitleArgument = args.options.listTitle || '';
|
|
28
28
|
const listRestUrl = (args.options.listId ?
|
|
29
|
-
`${args.options.webUrl}/_api/web/lists(guid'${
|
|
30
|
-
: `${args.options.webUrl}/_api/web/lists/getByTitle('${
|
|
29
|
+
`${args.options.webUrl}/_api/web/lists(guid'${utils_1.formatting.encodeQueryParameter(listIdArgument)}')`
|
|
30
|
+
: `${args.options.webUrl}/_api/web/lists/getByTitle('${utils_1.formatting.encodeQueryParameter(listTitleArgument)}')`);
|
|
31
31
|
let contentTypeName = '';
|
|
32
32
|
let targetFolderServerRelativeUrl = '';
|
|
33
33
|
if (this.verbose) {
|
|
@@ -24,8 +24,8 @@ class SpoListItemAttachmentListCommand extends SpoCommand_1.default {
|
|
|
24
24
|
const listIdArgument = args.options.listId || '';
|
|
25
25
|
const listTitleArgument = args.options.listTitle || '';
|
|
26
26
|
const listRestUrl = (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(listIdArgument)}')`
|
|
28
|
+
: `${args.options.webUrl}/_api/web/lists/getByTitle('${utils_1.formatting.encodeQueryParameter(listTitleArgument)}')`);
|
|
29
29
|
const requestOptions = {
|
|
30
30
|
url: `${listRestUrl}/items(${args.options.itemId})?$select=AttachmentFiles&$expand=AttachmentFiles`,
|
|
31
31
|
method: 'GET',
|
|
@@ -24,8 +24,8 @@ class SpoListItemGetCommand extends SpoCommand_1.default {
|
|
|
24
24
|
const listIdArgument = args.options.listId || '';
|
|
25
25
|
const listTitleArgument = args.options.listTitle || '';
|
|
26
26
|
const listRestUrl = (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(listIdArgument)}')`
|
|
28
|
+
: `${args.options.webUrl}/_api/web/lists/getByTitle('${utils_1.formatting.encodeQueryParameter(listTitleArgument)}')`);
|
|
29
29
|
const propertiesSelect = args.options.properties ?
|
|
30
30
|
`?$select=${encodeURIComponent(args.options.properties)}` :
|
|
31
31
|
((!args.options.output || args.options.output === 'text') ?
|
|
@@ -25,8 +25,8 @@ class SpoListItemIsRecordCommand extends SpoCommand_1.default {
|
|
|
25
25
|
const listIdArgument = args.options.listId || '';
|
|
26
26
|
const listTitleArgument = args.options.listTitle || '';
|
|
27
27
|
const listRestUrl = (args.options.listId ?
|
|
28
|
-
`${args.options.webUrl}/_api/web/lists(guid'${
|
|
29
|
-
: `${args.options.webUrl}/_api/web/lists/getByTitle('${
|
|
28
|
+
`${args.options.webUrl}/_api/web/lists(guid'${utils_1.formatting.encodeQueryParameter(listIdArgument)}')`
|
|
29
|
+
: `${args.options.webUrl}/_api/web/lists/getByTitle('${utils_1.formatting.encodeQueryParameter(listTitleArgument)}')`);
|
|
30
30
|
let formDigestValue = '';
|
|
31
31
|
let listId = '';
|
|
32
32
|
if (this.debug) {
|
|
@@ -14,6 +14,8 @@ class SpoListItemListCommand extends SpoCommand_1.default {
|
|
|
14
14
|
getTelemetryProperties(args) {
|
|
15
15
|
const telemetryProps = super.getTelemetryProperties(args);
|
|
16
16
|
telemetryProps.id = typeof args.options.id !== 'undefined';
|
|
17
|
+
telemetryProps.listId = typeof args.options.listId !== 'undefined';
|
|
18
|
+
telemetryProps.listTitle = typeof args.options.listTitle !== 'undefined';
|
|
17
19
|
telemetryProps.title = typeof args.options.title !== 'undefined';
|
|
18
20
|
telemetryProps.fields = typeof args.options.fields !== 'undefined';
|
|
19
21
|
telemetryProps.filter = typeof args.options.filter !== 'undefined';
|
|
@@ -23,14 +25,20 @@ class SpoListItemListCommand extends SpoCommand_1.default {
|
|
|
23
25
|
return telemetryProps;
|
|
24
26
|
}
|
|
25
27
|
commandAction(logger, args, cb) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
if (args.options.id) {
|
|
29
|
+
this.warn(logger, `Option 'id' is deprecated. Please use 'listId' instead.`);
|
|
30
|
+
}
|
|
31
|
+
if (args.options.title) {
|
|
32
|
+
this.warn(logger, `Option 'title' is deprecated. Please use 'listTitle' instead.`);
|
|
33
|
+
}
|
|
34
|
+
const listIdArgument = args.options.listId || args.options.id || '';
|
|
35
|
+
const listTitleArgument = args.options.listTitle || args.options.title || '';
|
|
28
36
|
let formDigestValue = '';
|
|
29
37
|
const fieldsArray = args.options.fields ? args.options.fields.split(",")
|
|
30
38
|
: (!args.options.output || args.options.output === "text") ? ["Title", "Id"] : [];
|
|
31
|
-
const listRestUrl =
|
|
32
|
-
`${args.options.webUrl}/_api/web/lists(guid'${
|
|
33
|
-
: `${args.options.webUrl}/_api/web/lists/getByTitle('${
|
|
39
|
+
const listRestUrl = listIdArgument ?
|
|
40
|
+
`${args.options.webUrl}/_api/web/lists(guid'${utils_1.formatting.encodeQueryParameter(listIdArgument)}')`
|
|
41
|
+
: `${args.options.webUrl}/_api/web/lists/getByTitle('${utils_1.formatting.encodeQueryParameter(listTitleArgument)}')`;
|
|
34
42
|
(() => {
|
|
35
43
|
if (args.options.camlQuery) {
|
|
36
44
|
if (this.debug) {
|
|
@@ -100,10 +108,16 @@ class SpoListItemListCommand extends SpoCommand_1.default {
|
|
|
100
108
|
option: '-u, --webUrl <webUrl>'
|
|
101
109
|
},
|
|
102
110
|
{
|
|
103
|
-
option: '
|
|
111
|
+
option: '--id [id]'
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
option: '--title [title]'
|
|
104
115
|
},
|
|
105
116
|
{
|
|
106
|
-
option: '-
|
|
117
|
+
option: '-i, --listId [listId]'
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
option: '-t, --listTitle [listTitle]'
|
|
107
121
|
},
|
|
108
122
|
{
|
|
109
123
|
option: '-s, --pageSize [pageSize]'
|
|
@@ -143,12 +157,16 @@ class SpoListItemListCommand extends SpoCommand_1.default {
|
|
|
143
157
|
if (isValidSharePointUrl !== true) {
|
|
144
158
|
return isValidSharePointUrl;
|
|
145
159
|
}
|
|
146
|
-
if (!args.options.id && !args.options.title) {
|
|
147
|
-
return `Specify
|
|
160
|
+
if (!args.options.id && !args.options.title && !args.options.listId && !args.options.listTitle) {
|
|
161
|
+
return `Specify listId or listTitle`;
|
|
148
162
|
}
|
|
149
163
|
if (args.options.id && args.options.title) {
|
|
150
164
|
return `Specify list id or title but not both`;
|
|
151
165
|
}
|
|
166
|
+
// Check if only one of the 4 options is specified
|
|
167
|
+
if ([args.options.id, args.options.title, args.options.listId, args.options.listTitle].filter(o => o).length > 1) {
|
|
168
|
+
return 'Specify listId or listTitle but not both';
|
|
169
|
+
}
|
|
152
170
|
if (args.options.camlQuery && args.options.fields) {
|
|
153
171
|
return `Specify camlQuery or fields but not both`;
|
|
154
172
|
}
|
|
@@ -167,8 +185,10 @@ class SpoListItemListCommand extends SpoCommand_1.default {
|
|
|
167
185
|
if (args.options.pageNumber && isNaN(Number(args.options.pageNumber))) {
|
|
168
186
|
return `pageNumber must be numeric`;
|
|
169
187
|
}
|
|
170
|
-
if (args.options.
|
|
171
|
-
|
|
188
|
+
if (args.options.listId && !utils_1.validation.isValidGuid(args.options.listId)) {
|
|
189
|
+
return `${args.options.listId} is not a valid GUID`;
|
|
190
|
+
}
|
|
191
|
+
if (args.options.id && !utils_1.validation.isValidGuid(args.options.id)) {
|
|
172
192
|
return `${args.options.id} in option id is not a valid GUID`;
|
|
173
193
|
}
|
|
174
194
|
return true;
|
|
@@ -25,8 +25,8 @@ class SpoListItemRecordDeclareCommand extends SpoCommand_1.default {
|
|
|
25
25
|
let webIdentity = '';
|
|
26
26
|
let listId = '';
|
|
27
27
|
const listRestUrl = args.options.listId
|
|
28
|
-
? `${args.options.webUrl}/_api/web/lists(guid'${
|
|
29
|
-
: `${args.options.webUrl}/_api/web/lists/getByTitle('${
|
|
28
|
+
? `${args.options.webUrl}/_api/web/lists(guid'${utils_1.formatting.encodeQueryParameter(args.options.listId)}')`
|
|
29
|
+
: `${args.options.webUrl}/_api/web/lists/getByTitle('${utils_1.formatting.encodeQueryParameter(args.options.listTitle)}')`;
|
|
30
30
|
utils_1.spo
|
|
31
31
|
.getRequestDigest(args.options.webUrl)
|
|
32
32
|
.then((contextResponse) => {
|
|
@@ -22,8 +22,8 @@ class SpoListItemRecordUndeclareCommand extends SpoCommand_1.default {
|
|
|
22
22
|
const listIdArgument = args.options.listId || '';
|
|
23
23
|
const listTitleArgument = args.options.listTitle || '';
|
|
24
24
|
const listRestUrl = (args.options.listId ?
|
|
25
|
-
`${args.options.webUrl}/_api/web/lists(guid'${
|
|
26
|
-
: `${args.options.webUrl}/_api/web/lists/getByTitle('${
|
|
25
|
+
`${args.options.webUrl}/_api/web/lists(guid'${utils_1.formatting.encodeQueryParameter(listIdArgument)}')`
|
|
26
|
+
: `${args.options.webUrl}/_api/web/lists/getByTitle('${utils_1.formatting.encodeQueryParameter(listTitleArgument)}')`);
|
|
27
27
|
let formDigestValue = '';
|
|
28
28
|
let environmentListId = '';
|
|
29
29
|
(() => {
|
|
@@ -27,10 +27,10 @@ class SpoListItemRemoveCommand extends SpoCommand_1.default {
|
|
|
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)}')`;
|
|
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)}')`;
|
|
34
34
|
}
|
|
35
35
|
requestUrl += `/items(${args.options.id})`;
|
|
36
36
|
if (args.options.recycle) {
|
|
@@ -22,10 +22,10 @@ class SpoListItemRoleInheritanceBreakCommand extends SpoCommand_1.default {
|
|
|
22
22
|
}
|
|
23
23
|
let requestUrl = `${args.options.webUrl}/_api/web/lists`;
|
|
24
24
|
if (args.options.listId) {
|
|
25
|
-
requestUrl += `(guid'${
|
|
25
|
+
requestUrl += `(guid'${utils_1.formatting.encodeQueryParameter(args.options.listId)}')`;
|
|
26
26
|
}
|
|
27
27
|
else {
|
|
28
|
-
requestUrl += `/getbytitle('${
|
|
28
|
+
requestUrl += `/getbytitle('${utils_1.formatting.encodeQueryParameter(args.options.listTitle)}')`;
|
|
29
29
|
}
|
|
30
30
|
let keepExistingPermissions = true;
|
|
31
31
|
if (args.options.clearExistingPermissions) {
|
|
@@ -20,10 +20,10 @@ class SpoListItemRoleInheritanceResetCommand extends SpoCommand_1.default {
|
|
|
20
20
|
commandAction(logger, args, cb) {
|
|
21
21
|
let requestUrl = `${args.options.webUrl}/_api/web/lists`;
|
|
22
22
|
if (args.options.listId) {
|
|
23
|
-
requestUrl += `(guid'${
|
|
23
|
+
requestUrl += `(guid'${utils_1.formatting.encodeQueryParameter(args.options.listId)}')`;
|
|
24
24
|
}
|
|
25
25
|
else {
|
|
26
|
-
requestUrl += `/getbytitle('${
|
|
26
|
+
requestUrl += `/getbytitle('${utils_1.formatting.encodeQueryParameter(args.options.listTitle)}')`;
|
|
27
27
|
}
|
|
28
28
|
const requestOptions = {
|
|
29
29
|
url: `${requestUrl}/items(${args.options.listItemId})/resetroleinheritance`,
|
|
@@ -27,8 +27,8 @@ class SpoListItemSetCommand extends SpoCommand_1.default {
|
|
|
27
27
|
const listIdArgument = args.options.listId || '';
|
|
28
28
|
const listTitleArgument = args.options.listTitle || '';
|
|
29
29
|
const listRestUrl = (args.options.listId ?
|
|
30
|
-
`${args.options.webUrl}/_api/web/lists(guid'${
|
|
31
|
-
: `${args.options.webUrl}/_api/web/lists/getByTitle('${
|
|
30
|
+
`${args.options.webUrl}/_api/web/lists(guid'${utils_1.formatting.encodeQueryParameter(listIdArgument)}')`
|
|
31
|
+
: `${args.options.webUrl}/_api/web/lists/getByTitle('${utils_1.formatting.encodeQueryParameter(listTitleArgument)}')`);
|
|
32
32
|
let contentTypeName = '';
|
|
33
33
|
let formDigestValue = '';
|
|
34
34
|
let environmentListId = '';
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const cli_1 = require("../../../../cli");
|
|
4
|
+
const request_1 = require("../../../../request");
|
|
5
|
+
const utils_1 = require("../../../../utils");
|
|
6
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
7
|
+
const commands_1 = require("../../commands");
|
|
8
|
+
class SpoRoleDefinitionRemoveCommand extends SpoCommand_1.default {
|
|
9
|
+
get name() {
|
|
10
|
+
return commands_1.default.ROLEDEFINITION_REMOVE;
|
|
11
|
+
}
|
|
12
|
+
get description() {
|
|
13
|
+
return 'Removes the role definition from the specified site';
|
|
14
|
+
}
|
|
15
|
+
getTelemetryProperties(args) {
|
|
16
|
+
const telemetryProps = super.getTelemetryProperties(args);
|
|
17
|
+
telemetryProps.confirm = (!(!args.options.confirm)).toString();
|
|
18
|
+
return telemetryProps;
|
|
19
|
+
}
|
|
20
|
+
commandAction(logger, args, cb) {
|
|
21
|
+
const removeRoleDefinition = () => {
|
|
22
|
+
if (this.verbose) {
|
|
23
|
+
logger.logToStderr(`Removing role definition from site ${args.options.webUrl}...`);
|
|
24
|
+
}
|
|
25
|
+
const requestOptions = {
|
|
26
|
+
url: `${args.options.webUrl}/_api/web/roledefinitions(${args.options.id})`,
|
|
27
|
+
method: 'delete',
|
|
28
|
+
headers: {
|
|
29
|
+
'X-HTTP-Method': 'DELETE',
|
|
30
|
+
'If-Match': '*',
|
|
31
|
+
'accept': 'application/json;odata=nometadata'
|
|
32
|
+
},
|
|
33
|
+
responseType: 'json'
|
|
34
|
+
};
|
|
35
|
+
request_1.default
|
|
36
|
+
.delete(requestOptions)
|
|
37
|
+
.then(() => cb(), (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
38
|
+
};
|
|
39
|
+
if (args.options.confirm) {
|
|
40
|
+
removeRoleDefinition();
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
cli_1.Cli.prompt({
|
|
44
|
+
type: 'confirm',
|
|
45
|
+
name: 'continue',
|
|
46
|
+
default: false,
|
|
47
|
+
message: `Are you sure you want to remove the role definition with id ${args.options.id} from site ${args.options.webUrl}?`
|
|
48
|
+
}, (result) => {
|
|
49
|
+
if (!result.continue) {
|
|
50
|
+
cb();
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
removeRoleDefinition();
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
options() {
|
|
59
|
+
const options = [
|
|
60
|
+
{
|
|
61
|
+
option: '-u, --webUrl <webUrl>'
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
option: '-i, --id <id>'
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
option: '--confirm'
|
|
68
|
+
}
|
|
69
|
+
];
|
|
70
|
+
const parentOptions = super.options();
|
|
71
|
+
return options.concat(parentOptions);
|
|
72
|
+
}
|
|
73
|
+
validate(args) {
|
|
74
|
+
const id = parseInt(args.options.id);
|
|
75
|
+
if (isNaN(id)) {
|
|
76
|
+
return `${args.options.id} is not a valid role definition ID`;
|
|
77
|
+
}
|
|
78
|
+
return utils_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
module.exports = new SpoRoleDefinitionRemoveCommand();
|
|
82
|
+
//# sourceMappingURL=roledefinition-remove.js.map
|