@pnp/cli-microsoft365 7.2.0-beta.6775e3a → 7.2.0-beta.8577f52
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/allCommands.json +1 -0
- package/allCommandsFull.json +1 -0
- package/dist/Auth.js +1 -1
- package/dist/Command.js +13 -6
- package/dist/api.js +5 -7
- package/dist/cli/Cli.js +97 -119
- package/dist/cli/timings.js +9 -0
- package/dist/index.js +8 -14
- package/dist/m365/cli/commands/config/config-set.js +13 -0
- package/dist/m365/commands/login.js +12 -8
- package/dist/m365/flow/commands/environment/environment-list.js +6 -4
- package/dist/m365/spfx/commands/project/DeployWorkflow.js +4 -4
- package/dist/m365/spfx/commands/project/project-doctor/{doctor-1.18.1-rc.0.js → doctor-1.18.1.js} +1 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.18.2.js +21 -0
- package/dist/m365/spfx/commands/project/project-doctor.js +6 -3
- package/dist/m365/spfx/commands/project/project-github-workflow-add.js +17 -0
- package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.18.1-rc.0.js → upgrade-1.18.1.js} +26 -26
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.18.2.js +53 -0
- package/dist/m365/spfx/commands/project/project-upgrade.js +18 -17
- package/dist/m365/spfx/commands/spfx-doctor.js +16 -1
- package/dist/m365/spo/commands/file/file-retentionlabel-ensure.js +14 -23
- package/dist/m365/spo/commands/file/file-retentionlabel-remove.js +19 -27
- package/dist/m365/spo/commands/folder/folder-retentionlabel-ensure.js +9 -29
- package/dist/m365/spo/commands/folder/folder-retentionlabel-remove.js +9 -28
- package/dist/m365/spo/commands/list/list-retentionlabel-ensure.js +27 -37
- package/dist/m365/spo/commands/list/list-retentionlabel-remove.js +6 -19
- package/dist/m365/spo/commands/listitem/listitem-batch-add.js +5 -0
- package/dist/m365/spo/commands/listitem/listitem-retentionlabel-ensure.js +36 -37
- package/dist/m365/spo/commands/listitem/listitem-retentionlabel-remove.js +36 -32
- package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-grant-revoke.js +49 -12
- package/dist/m365/spo/commands/site/site-add.js +45 -12
- package/dist/m365/spo/commands/sitescript/sitescript-get.js +8 -2
- package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-restore.js +19 -2
- package/dist/m365/teams/commands/user/user-app-remove.js +18 -5
- package/dist/request.js +6 -0
- package/dist/settingsNames.js +2 -0
- package/dist/utils/prompt.js +5 -1
- package/dist/utils/spo.js +109 -0
- package/docs/docs/_clisettings.mdx +2 -0
- package/docs/docs/cmd/aad/approleassignment/approleassignment-add.mdx +1 -1
- package/docs/docs/cmd/aad/approleassignment/approleassignment-list.mdx +2 -2
- package/docs/docs/cmd/aad/approleassignment/approleassignment-remove.mdx +1 -1
- package/docs/docs/cmd/aad/oauth2grant/oauth2grant-add.mdx +1 -1
- package/docs/docs/cmd/aad/oauth2grant/oauth2grant-list.mdx +2 -2
- package/docs/docs/cmd/aad/oauth2grant/oauth2grant-remove.mdx +2 -2
- package/docs/docs/cmd/aad/oauth2grant/oauth2grant-set.mdx +2 -2
- package/docs/docs/cmd/aad/policy/policy-list.mdx +1 -1
- package/docs/docs/cmd/aad/siteclassification/siteclassification-disable.mdx +1 -1
- package/docs/docs/cmd/aad/siteclassification/siteclassification-enable.mdx +1 -1
- package/docs/docs/cmd/aad/siteclassification/siteclassification-get.mdx +1 -1
- package/docs/docs/cmd/aad/siteclassification/siteclassification-set.mdx +1 -1
- package/docs/docs/cmd/aad/sp/sp-add.mdx +2 -2
- package/docs/docs/cmd/aad/sp/sp-get.mdx +2 -2
- package/docs/docs/cmd/aad/user/user-add.mdx +3 -3
- package/docs/docs/cmd/aad/user/user-guest-add.mdx +1 -1
- package/docs/docs/cmd/aad/user/user-set.mdx +3 -3
- package/docs/docs/cmd/flow/run/run-cancel.mdx +3 -0
- package/docs/docs/cmd/graph/changelog/changelog-list.mdx +5 -5
- package/docs/docs/cmd/login.mdx +1 -1
- package/docs/docs/cmd/onenote/notebook/notebook-list.mdx +1 -1
- package/docs/docs/cmd/outlook/message/message-list.mdx +1 -1
- package/docs/docs/cmd/outlook/message/message-move.mdx +1 -1
- package/docs/docs/cmd/planner/bucket/bucket-add.mdx +1 -1
- package/docs/docs/cmd/planner/bucket/bucket-set.mdx +1 -1
- package/docs/docs/cmd/planner/plan/plan-set.mdx +3 -3
- package/docs/docs/cmd/planner/task/task-set.mdx +1 -1
- package/docs/docs/cmd/purview/auditlog/auditlog-list.mdx +3 -3
- package/docs/docs/cmd/purview/retentionevent/retentionevent-add.mdx +1 -1
- package/docs/docs/cmd/purview/retentionevent/retentionevent-get.mdx +1 -1
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-add.mdx +1 -1
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-get.mdx +1 -1
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-remove.mdx +1 -1
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-set.mdx +1 -1
- package/docs/docs/cmd/purview/retentionlabel/retentionlabel-add.mdx +1 -1
- package/docs/docs/cmd/purview/sensitivitylabel/sensitivitylabel-policysettings-list.mdx +4 -4
- package/docs/docs/cmd/spfx/project/project-upgrade.mdx +1 -1
- package/docs/docs/cmd/spo/app/app-add.mdx +1 -1
- package/docs/docs/cmd/spo/app/app-deploy.mdx +1 -1
- package/docs/docs/cmd/spo/app/app-get.mdx +1 -1
- package/docs/docs/cmd/spo/app/app-install.mdx +1 -1
- package/docs/docs/cmd/spo/app/app-list.mdx +1 -1
- package/docs/docs/cmd/spo/app/app-remove.mdx +1 -1
- package/docs/docs/cmd/spo/app/app-retract.mdx +1 -1
- package/docs/docs/cmd/spo/app/app-uninstall.mdx +1 -1
- package/docs/docs/cmd/spo/app/app-upgrade.mdx +1 -1
- package/docs/docs/cmd/spo/contenttype/contenttype-add.mdx +1 -1
- package/docs/docs/cmd/spo/contenttype/contenttype-set.mdx +1 -1
- package/docs/docs/cmd/spo/hidedefaultthemes/hidedefaultthemes-get.mdx +1 -1
- package/docs/docs/cmd/spo/hidedefaultthemes/hidedefaultthemes-set.mdx +1 -1
- package/docs/docs/cmd/spo/serviceprincipal/serviceprincipal-grant-revoke.mdx +10 -1
- package/docs/docs/cmd/spo/site/site-add.mdx +25 -4
- package/docs/docs/cmd/spo/site/site-appcatalog-add.mdx +1 -1
- package/docs/docs/cmd/spo/site/site-appcatalog-remove.mdx +1 -1
- package/docs/docs/cmd/spo/site/site-groupify.mdx +1 -1
- package/docs/docs/cmd/spo/sitedesign/sitedesign-add.mdx +3 -3
- package/docs/docs/cmd/spo/sitedesign/sitedesign-apply.mdx +1 -1
- package/docs/docs/cmd/spo/sitedesign/sitedesign-get.mdx +1 -1
- package/docs/docs/cmd/spo/sitedesign/sitedesign-list.mdx +1 -1
- package/docs/docs/cmd/spo/sitedesign/sitedesign-remove.mdx +1 -1
- package/docs/docs/cmd/spo/sitedesign/sitedesign-rights-grant.mdx +1 -1
- package/docs/docs/cmd/spo/sitedesign/sitedesign-rights-list.mdx +1 -1
- package/docs/docs/cmd/spo/sitedesign/sitedesign-rights-revoke.mdx +1 -1
- package/docs/docs/cmd/spo/sitedesign/sitedesign-run-list.mdx +1 -1
- package/docs/docs/cmd/spo/sitedesign/sitedesign-run-status-get.mdx +1 -1
- package/docs/docs/cmd/spo/sitedesign/sitedesign-set.mdx +3 -3
- package/docs/docs/cmd/spo/sitedesign/sitedesign-task-get.mdx +1 -1
- package/docs/docs/cmd/spo/sitedesign/sitedesign-task-list.mdx +1 -1
- package/docs/docs/cmd/spo/sitedesign/sitedesign-task-remove.mdx +1 -1
- package/docs/docs/cmd/spo/sitescript/sitescript-add.mdx +1 -1
- package/docs/docs/cmd/spo/sitescript/sitescript-get.mdx +73 -3
- package/docs/docs/cmd/spo/sitescript/sitescript-list.mdx +1 -1
- package/docs/docs/cmd/spo/sitescript/sitescript-remove.mdx +1 -1
- package/docs/docs/cmd/spo/sitescript/sitescript-set.mdx +1 -1
- package/docs/docs/cmd/spo/storageentity/storageentity-get.mdx +1 -1
- package/docs/docs/cmd/spo/storageentity/storageentity-list.mdx +1 -1
- package/docs/docs/cmd/spo/storageentity/storageentity-remove.mdx +1 -1
- package/docs/docs/cmd/spo/storageentity/storageentity-set.mdx +1 -1
- package/docs/docs/cmd/spo/theme/theme-apply.mdx +1 -1
- package/docs/docs/cmd/spo/theme/theme-get.mdx +1 -1
- package/docs/docs/cmd/spo/theme/theme-list.mdx +1 -1
- package/docs/docs/cmd/spo/theme/theme-remove.mdx +1 -1
- package/docs/docs/cmd/spo/user/user-remove.mdx +1 -1
- package/docs/docs/cmd/spo/web/web-set.mdx +1 -1
- package/docs/docs/cmd/teams/channel/channel-remove.mdx +1 -1
- package/docs/docs/cmd/teams/meeting/meeting-get.mdx +1 -1
- package/docs/docs/cmd/teams/meeting/meeting-transcript-list.mdx +1 -1
- package/docs/docs/cmd/teams/report/report-pstncalls.mdx +1 -1
- package/docs/docs/cmd/teams/tab/tab-remove.mdx +1 -1
- package/docs/docs/cmd/teams/team/team-remove.mdx +1 -1
- package/docs/docs/cmd/teams/user/user-app-remove.mdx +11 -2
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-list.mdx +1 -1
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-get.mdx +1 -1
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-list.mdx +1 -1
- package/docs/docs/cmd/todo/task/task-set.mdx +1 -1
- package/npm-shrinkwrap.json +480 -516
- package/package.json +33 -32
|
@@ -6,6 +6,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
6
6
|
var _SpoListRetentionLabelEnsureCommand_instances, _SpoListRetentionLabelEnsureCommand_initTelemetry, _SpoListRetentionLabelEnsureCommand_initOptions, _SpoListRetentionLabelEnsureCommand_initValidators, _SpoListRetentionLabelEnsureCommand_initOptionSets;
|
|
7
7
|
import request from '../../../../request.js';
|
|
8
8
|
import { formatting } from '../../../../utils/formatting.js';
|
|
9
|
+
import { spo } from '../../../../utils/spo.js';
|
|
9
10
|
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
10
11
|
import { validation } from '../../../../utils/validation.js';
|
|
11
12
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
@@ -27,49 +28,38 @@ class SpoListRetentionLabelEnsureCommand extends SpoCommand {
|
|
|
27
28
|
}
|
|
28
29
|
async commandAction(logger, args) {
|
|
29
30
|
try {
|
|
30
|
-
|
|
31
|
-
let listServerRelativeUrl = '';
|
|
32
|
-
if (args.options.listUrl) {
|
|
33
|
-
const listServerRelativeUrlFromPath = urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
|
|
34
|
-
listServerRelativeUrl = listServerRelativeUrlFromPath;
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
if (args.options.listId) {
|
|
38
|
-
listRestUrl = `lists(guid'${formatting.encodeQueryParameter(args.options.listId)}')/`;
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
listRestUrl = `lists/getByTitle('${formatting.encodeQueryParameter(args.options.listTitle)}')/`;
|
|
42
|
-
}
|
|
43
|
-
const requestOptions = {
|
|
44
|
-
url: `${args.options.webUrl}/_api/web/${listRestUrl}?$expand=RootFolder&$select=RootFolder`,
|
|
45
|
-
headers: {
|
|
46
|
-
'accept': 'application/json;odata=nometadata'
|
|
47
|
-
},
|
|
48
|
-
responseType: 'json'
|
|
49
|
-
};
|
|
50
|
-
const listInstance = await request.get(requestOptions);
|
|
51
|
-
listServerRelativeUrl = listInstance.RootFolder.ServerRelativeUrl;
|
|
52
|
-
}
|
|
31
|
+
const listServerRelativeUrl = await this.getListServerRelativeUrl(args, logger);
|
|
53
32
|
const listAbsoluteUrl = urlUtil.getAbsoluteUrl(args.options.webUrl, listServerRelativeUrl);
|
|
54
|
-
|
|
55
|
-
const requestOptions = {
|
|
56
|
-
url: requestUrl,
|
|
57
|
-
headers: {
|
|
58
|
-
'accept': 'application/json;odata=nometadata'
|
|
59
|
-
},
|
|
60
|
-
data: {
|
|
61
|
-
listUrl: listAbsoluteUrl,
|
|
62
|
-
complianceTagValue: args.options.name,
|
|
63
|
-
syncToItems: args.options.syncToItems || false
|
|
64
|
-
},
|
|
65
|
-
responseType: 'json'
|
|
66
|
-
};
|
|
67
|
-
await request.post(requestOptions);
|
|
33
|
+
await spo.applyDefaultRetentionLabelToList(args.options.webUrl, args.options.name, listAbsoluteUrl, args.options.syncToItems, logger, args.options.verbose);
|
|
68
34
|
}
|
|
69
35
|
catch (err) {
|
|
70
36
|
this.handleRejectedODataJsonPromise(err);
|
|
71
37
|
}
|
|
72
38
|
}
|
|
39
|
+
async getListServerRelativeUrl(args, logger) {
|
|
40
|
+
if (this.verbose) {
|
|
41
|
+
logger.logToStderr('Getting the list server relative URL');
|
|
42
|
+
}
|
|
43
|
+
if (args.options.listUrl) {
|
|
44
|
+
return urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
|
|
45
|
+
}
|
|
46
|
+
let requestUrl = `${args.options.webUrl}/_api/web/`;
|
|
47
|
+
if (args.options.listId) {
|
|
48
|
+
requestUrl += `lists(guid'${formatting.encodeQueryParameter(args.options.listId)}')/`;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
requestUrl += `lists/getByTitle('${formatting.encodeQueryParameter(args.options.listTitle)}')/`;
|
|
52
|
+
}
|
|
53
|
+
const requestOptions = {
|
|
54
|
+
url: `${requestUrl}?$expand=RootFolder&$select=RootFolder/ServerRelativeUrl`,
|
|
55
|
+
headers: {
|
|
56
|
+
'accept': 'application/json;odata=nometadata'
|
|
57
|
+
},
|
|
58
|
+
responseType: 'json'
|
|
59
|
+
};
|
|
60
|
+
const listInstance = await request.get(requestOptions);
|
|
61
|
+
return listInstance.RootFolder.ServerRelativeUrl;
|
|
62
|
+
}
|
|
73
63
|
}
|
|
74
64
|
_SpoListRetentionLabelEnsureCommand_instances = new WeakSet(), _SpoListRetentionLabelEnsureCommand_initTelemetry = function _SpoListRetentionLabelEnsureCommand_initTelemetry() {
|
|
75
65
|
this.telemetry.push((args) => {
|
|
@@ -11,6 +11,7 @@ import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
|
11
11
|
import { validation } from '../../../../utils/validation.js';
|
|
12
12
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
13
13
|
import commands from '../../commands.js';
|
|
14
|
+
import { spo } from '../../../../utils/spo.js';
|
|
14
15
|
class SpoListRetentionLabelRemoveCommand extends SpoCommand {
|
|
15
16
|
get name() {
|
|
16
17
|
return commands.LIST_RETENTIONLABEL_REMOVE;
|
|
@@ -44,21 +45,7 @@ class SpoListRetentionLabelRemoveCommand extends SpoCommand {
|
|
|
44
45
|
try {
|
|
45
46
|
const listServerRelativeUrl = await this.getListServerRelativeUrl(args, logger);
|
|
46
47
|
const listAbsoluteUrl = urlUtil.getAbsoluteUrl(args.options.webUrl, listServerRelativeUrl);
|
|
47
|
-
|
|
48
|
-
url: `${args.options.webUrl}/_api/SP_CompliancePolicy_SPPolicyStoreProxy_SetListComplianceTag`,
|
|
49
|
-
headers: {
|
|
50
|
-
'accept': 'application/json;odata=nometadata'
|
|
51
|
-
},
|
|
52
|
-
data: {
|
|
53
|
-
listUrl: listAbsoluteUrl,
|
|
54
|
-
complianceTagValue: '',
|
|
55
|
-
blockDelete: false,
|
|
56
|
-
blockEdit: false,
|
|
57
|
-
syncToItems: false
|
|
58
|
-
},
|
|
59
|
-
responseType: 'json'
|
|
60
|
-
};
|
|
61
|
-
await request.post(requestOptions);
|
|
48
|
+
await spo.removeDefaultRetentionLabelFromList(args.options.webUrl, listAbsoluteUrl, logger, args.options.verbose);
|
|
62
49
|
}
|
|
63
50
|
catch (err) {
|
|
64
51
|
this.handleRejectedODataJsonPromise(err);
|
|
@@ -71,15 +58,15 @@ class SpoListRetentionLabelRemoveCommand extends SpoCommand {
|
|
|
71
58
|
if (args.options.listUrl) {
|
|
72
59
|
return urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
|
|
73
60
|
}
|
|
74
|
-
let
|
|
61
|
+
let requestUrl = `${args.options.webUrl}/_api/web/`;
|
|
75
62
|
if (args.options.listId) {
|
|
76
|
-
|
|
63
|
+
requestUrl += `lists(guid'${formatting.encodeQueryParameter(args.options.listId)}')/`;
|
|
77
64
|
}
|
|
78
65
|
else {
|
|
79
|
-
|
|
66
|
+
requestUrl += `lists/getByTitle('${formatting.encodeQueryParameter(args.options.listTitle)}')/`;
|
|
80
67
|
}
|
|
81
68
|
const requestOptions = {
|
|
82
|
-
url: `${
|
|
69
|
+
url: `${requestUrl}?$expand=RootFolder&$select=RootFolder/ServerRelativeUrl`,
|
|
83
70
|
headers: {
|
|
84
71
|
'accept': 'application/json;odata=nometadata'
|
|
85
72
|
},
|
|
@@ -111,6 +111,11 @@ class SpoListItemBatchAddCommand extends SpoCommand {
|
|
|
111
111
|
.filter((line) => line.startsWith('{'))
|
|
112
112
|
.forEach((line, index) => {
|
|
113
113
|
const parsedResponse = JSON.parse(line);
|
|
114
|
+
if (parsedResponse.error) {
|
|
115
|
+
// if an error object is returned, the request failed
|
|
116
|
+
const error = parsedResponse.error;
|
|
117
|
+
throw error.message.value;
|
|
118
|
+
}
|
|
114
119
|
parsedResponse.value.forEach((fieldValueResult) => {
|
|
115
120
|
batchResults.push({
|
|
116
121
|
csvLineNumber: (index + 2),
|
|
@@ -4,14 +4,15 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _SpoListItemRetentionLabelEnsureCommand_instances, _SpoListItemRetentionLabelEnsureCommand_initTelemetry, _SpoListItemRetentionLabelEnsureCommand_initOptions, _SpoListItemRetentionLabelEnsureCommand_initValidators, _SpoListItemRetentionLabelEnsureCommand_initOptionSets;
|
|
7
|
-
import
|
|
7
|
+
import * as url from 'url';
|
|
8
8
|
import request from '../../../../request.js';
|
|
9
9
|
import { formatting } from '../../../../utils/formatting.js';
|
|
10
10
|
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
11
11
|
import { validation } from '../../../../utils/validation.js';
|
|
12
12
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
13
13
|
import commands from '../../commands.js';
|
|
14
|
-
import
|
|
14
|
+
import { spo } from '../../../../utils/spo.js';
|
|
15
|
+
import { odata } from '../../../../utils/odata.js';
|
|
15
16
|
class SpoListItemRetentionLabelEnsureCommand extends SpoCommand {
|
|
16
17
|
get name() {
|
|
17
18
|
return commands.LISTITEM_RETENTIONLABEL_ENSURE;
|
|
@@ -29,68 +30,66 @@ class SpoListItemRetentionLabelEnsureCommand extends SpoCommand {
|
|
|
29
30
|
}
|
|
30
31
|
async commandAction(logger, args) {
|
|
31
32
|
try {
|
|
32
|
-
const
|
|
33
|
+
const listAbsoluteUrl = await this.getListAbsoluteUrl(args.options, logger);
|
|
34
|
+
const labelName = await this.getLabelName(args.options, logger);
|
|
33
35
|
if (args.options.assetId) {
|
|
34
36
|
await this.applyAssetId(args.options, logger);
|
|
35
37
|
}
|
|
36
|
-
await
|
|
38
|
+
await spo.applyRetentionLabelToListItems(args.options.webUrl, labelName, listAbsoluteUrl, [parseInt(args.options.listItemId)], logger, args.options.verbose);
|
|
37
39
|
}
|
|
38
40
|
catch (err) {
|
|
39
41
|
this.handleRejectedODataJsonPromise(err);
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
|
-
async
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
debug: options.debug,
|
|
47
|
-
verbose: options.verbose
|
|
48
|
-
};
|
|
49
|
-
const output = await Cli.executeCommandWithOutput(spoWebRetentionLabelListCommand, { options: { ...cmdOptions, _: [] } });
|
|
44
|
+
async getLabelName(options, logger) {
|
|
45
|
+
if (options.name) {
|
|
46
|
+
return options.name;
|
|
47
|
+
}
|
|
50
48
|
if (this.verbose) {
|
|
51
|
-
|
|
49
|
+
logger.logToStderr(`Retrieving the name of the retention label based on the Id '${options.id}'...`);
|
|
50
|
+
}
|
|
51
|
+
const requestUrl = `${options.webUrl}/_api/SP.CompliancePolicy.SPPolicyStoreProxy.GetAvailableTagsForSite(siteUrl=@a1)?@a1='${formatting.encodeQueryParameter(options.webUrl)}'`;
|
|
52
|
+
const labels = await odata.getAllItems(requestUrl);
|
|
53
|
+
const label = labels.find(l => l.TagId === options.id);
|
|
54
|
+
if (label === undefined) {
|
|
55
|
+
throw new Error(`The specified retention label does not exist or is not published to this SharePoint site. Use the name of the label if you want to apply an unpublished label.`);
|
|
52
56
|
}
|
|
53
|
-
const labels = JSON.parse(output.stdout);
|
|
54
|
-
const label = labels.find(l => l.TagName === options.name || l.TagId === options.id);
|
|
55
57
|
if (this.verbose && label !== undefined) {
|
|
56
58
|
await logger.logToStderr(`Retention label found in the list of available labels: '${label.TagName}' / '${label.TagId}'...`);
|
|
57
59
|
}
|
|
58
|
-
|
|
59
|
-
throw new Error(`The specified retention label does not exist`);
|
|
60
|
-
}
|
|
61
|
-
return {
|
|
62
|
-
complianceTag: label.TagName,
|
|
63
|
-
isTagPolicyHold: label.BlockDelete,
|
|
64
|
-
isTagPolicyRecord: label.BlockEdit,
|
|
65
|
-
isEventBasedTag: label.IsEventTag,
|
|
66
|
-
isTagSuperLock: label.SuperLock,
|
|
67
|
-
isUnlockedAsDefault: label.UnlockedAsDefault
|
|
68
|
-
};
|
|
60
|
+
return label.TagName;
|
|
69
61
|
}
|
|
70
|
-
async
|
|
62
|
+
async getListAbsoluteUrl(options, logger) {
|
|
63
|
+
const parsedUrl = url.parse(options.webUrl);
|
|
64
|
+
const tenantUrl = `${parsedUrl.protocol}//${parsedUrl.hostname}`;
|
|
65
|
+
if (options.listUrl) {
|
|
66
|
+
const serverRelativePath = urlUtil.getServerRelativePath(options.webUrl, options.listUrl);
|
|
67
|
+
return urlUtil.urlCombine(tenantUrl, serverRelativePath);
|
|
68
|
+
}
|
|
71
69
|
if (this.verbose) {
|
|
72
|
-
await logger.logToStderr(`
|
|
70
|
+
await logger.logToStderr(`Retrieving list absolute URL...`);
|
|
73
71
|
}
|
|
74
72
|
let requestUrl = `${options.webUrl}/_api/web`;
|
|
75
73
|
if (options.listId) {
|
|
76
|
-
requestUrl += `/lists(guid'${formatting.encodeQueryParameter(options.listId)}')
|
|
74
|
+
requestUrl += `/lists(guid'${formatting.encodeQueryParameter(options.listId)}')`;
|
|
77
75
|
}
|
|
78
76
|
else if (options.listTitle) {
|
|
79
|
-
requestUrl += `/lists/getByTitle('${formatting.encodeQueryParameter(options.listTitle)}')
|
|
80
|
-
}
|
|
81
|
-
else if (options.listUrl) {
|
|
82
|
-
const listServerRelativeUrl = urlUtil.getServerRelativePath(options.webUrl, options.listUrl);
|
|
83
|
-
requestUrl += `/GetList(@listUrl)/items(${options.listItemId})/SetComplianceTag()?@listUrl='${formatting.encodeQueryParameter(listServerRelativeUrl)}'`;
|
|
77
|
+
requestUrl += `/lists/getByTitle('${formatting.encodeQueryParameter(options.listTitle)}')`;
|
|
84
78
|
}
|
|
85
79
|
const requestOptions = {
|
|
86
|
-
url: requestUrl
|
|
80
|
+
url: `${requestUrl}?$expand=RootFolder&$select=RootFolder/ServerRelativeUrl`,
|
|
87
81
|
headers: {
|
|
88
82
|
'accept': 'application/json;odata=nometadata'
|
|
89
83
|
},
|
|
90
|
-
data: labelInformation,
|
|
91
84
|
responseType: 'json'
|
|
92
85
|
};
|
|
93
|
-
await request.
|
|
86
|
+
const response = await request.get(requestOptions);
|
|
87
|
+
const serverRelativePath = urlUtil.getServerRelativePath(options.webUrl, response.RootFolder.ServerRelativeUrl);
|
|
88
|
+
const listAbsoluteUrl = urlUtil.urlCombine(tenantUrl, serverRelativePath);
|
|
89
|
+
if (this.verbose) {
|
|
90
|
+
logger.logToStderr(`List absolute URL found: '${listAbsoluteUrl}'`);
|
|
91
|
+
}
|
|
92
|
+
return listAbsoluteUrl;
|
|
94
93
|
}
|
|
95
94
|
async applyAssetId(options, logger) {
|
|
96
95
|
if (this.verbose) {
|
|
@@ -4,6 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _SpoListItemRetentionLabelRemoveCommand_instances, _SpoListItemRetentionLabelRemoveCommand_initTelemetry, _SpoListItemRetentionLabelRemoveCommand_initOptions, _SpoListItemRetentionLabelRemoveCommand_initValidators, _SpoListItemRetentionLabelRemoveCommand_initOptionSets;
|
|
7
|
+
import * as url from 'url';
|
|
7
8
|
import { Cli } from '../../../../cli/Cli.js';
|
|
8
9
|
import request from '../../../../request.js';
|
|
9
10
|
import { formatting } from '../../../../utils/formatting.js';
|
|
@@ -11,6 +12,7 @@ import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
|
11
12
|
import { validation } from '../../../../utils/validation.js';
|
|
12
13
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
13
14
|
import commands from '../../commands.js';
|
|
15
|
+
import { spo } from '../../../../utils/spo.js';
|
|
14
16
|
class SpoListItemRetentionLabelRemoveCommand extends SpoCommand {
|
|
15
17
|
get name() {
|
|
16
18
|
return commands.LISTITEM_RETENTIONLABEL_REMOVE;
|
|
@@ -38,44 +40,46 @@ class SpoListItemRetentionLabelRemoveCommand extends SpoCommand {
|
|
|
38
40
|
}
|
|
39
41
|
}
|
|
40
42
|
async removeListItemRetentionLabel(logger, args) {
|
|
41
|
-
if (this.verbose) {
|
|
42
|
-
await logger.logToStderr(`Removing retention label from list item ${args.options.listItemId} from list '${args.options.listId || args.options.listTitle || args.options.listUrl}' in site at ${args.options.webUrl}...`);
|
|
43
|
-
}
|
|
44
43
|
try {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
url += `/lists(guid'${formatting.encodeQueryParameter(args.options.listId)}')/items(${args.options.listItemId})/SetComplianceTag()`;
|
|
48
|
-
}
|
|
49
|
-
else if (args.options.listTitle) {
|
|
50
|
-
url += `/lists/getByTitle('${formatting.encodeQueryParameter(args.options.listTitle)}')/items(${args.options.listItemId})/SetComplianceTag()`;
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
const listServerRelativeUrl = urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
|
|
54
|
-
url += `/GetList(@a1)/items(@a2)/SetComplianceTag()?@a1='${formatting.encodeQueryParameter(listServerRelativeUrl)}'&@a2='${args.options.listItemId}'`;
|
|
55
|
-
}
|
|
56
|
-
const requestBody = {
|
|
57
|
-
"complianceTag": "",
|
|
58
|
-
"isTagPolicyHold": false,
|
|
59
|
-
"isTagPolicyRecord": false,
|
|
60
|
-
"isEventBasedTag": false,
|
|
61
|
-
"isTagSuperLock": false,
|
|
62
|
-
"isUnlockedAsDefault": false
|
|
63
|
-
};
|
|
64
|
-
const requestOptions = {
|
|
65
|
-
url: url,
|
|
66
|
-
method: 'POST',
|
|
67
|
-
headers: {
|
|
68
|
-
'accept': 'application/json;odata=nometadata'
|
|
69
|
-
},
|
|
70
|
-
data: requestBody,
|
|
71
|
-
responseType: 'json'
|
|
72
|
-
};
|
|
73
|
-
await request.post(requestOptions);
|
|
44
|
+
const listAbsoluteUrl = await this.getListAbsoluteUrl(args.options, logger);
|
|
45
|
+
await spo.removeRetentionLabelFromListItems(args.options.webUrl, listAbsoluteUrl, [parseInt(args.options.listItemId)], logger, args.options.verbose);
|
|
74
46
|
}
|
|
75
47
|
catch (err) {
|
|
76
48
|
this.handleRejectedODataJsonPromise(err);
|
|
77
49
|
}
|
|
78
50
|
}
|
|
51
|
+
async getListAbsoluteUrl(options, logger) {
|
|
52
|
+
const parsedUrl = url.parse(options.webUrl);
|
|
53
|
+
const tenantUrl = `${parsedUrl.protocol}//${parsedUrl.hostname}`;
|
|
54
|
+
if (options.listUrl) {
|
|
55
|
+
const serverRelativePath = urlUtil.getServerRelativePath(options.webUrl, options.listUrl);
|
|
56
|
+
return urlUtil.urlCombine(tenantUrl, serverRelativePath);
|
|
57
|
+
}
|
|
58
|
+
if (this.verbose) {
|
|
59
|
+
logger.logToStderr(`Retrieving list absolute URL...`);
|
|
60
|
+
}
|
|
61
|
+
let requestUrl = `${options.webUrl}/_api/web`;
|
|
62
|
+
if (options.listId) {
|
|
63
|
+
requestUrl += `/lists(guid'${formatting.encodeQueryParameter(options.listId)}')`;
|
|
64
|
+
}
|
|
65
|
+
else if (options.listTitle) {
|
|
66
|
+
requestUrl += `/lists/getByTitle('${formatting.encodeQueryParameter(options.listTitle)}')`;
|
|
67
|
+
}
|
|
68
|
+
const requestOptions = {
|
|
69
|
+
url: `${requestUrl}?$expand=RootFolder&$select=RootFolder/ServerRelativeUrl`,
|
|
70
|
+
headers: {
|
|
71
|
+
'accept': 'application/json;odata=nometadata'
|
|
72
|
+
},
|
|
73
|
+
responseType: 'json'
|
|
74
|
+
};
|
|
75
|
+
const response = await request.get(requestOptions);
|
|
76
|
+
const serverRelativePath = urlUtil.getServerRelativePath(options.webUrl, response.RootFolder.ServerRelativeUrl);
|
|
77
|
+
const listAbsoluteUrl = urlUtil.urlCombine(tenantUrl, serverRelativePath);
|
|
78
|
+
if (this.verbose) {
|
|
79
|
+
logger.logToStderr(`List absolute URL found: '${listAbsoluteUrl}'`);
|
|
80
|
+
}
|
|
81
|
+
return listAbsoluteUrl;
|
|
82
|
+
}
|
|
79
83
|
}
|
|
80
84
|
_SpoListItemRetentionLabelRemoveCommand_instances = new WeakSet(), _SpoListItemRetentionLabelRemoveCommand_initTelemetry = function _SpoListItemRetentionLabelRemoveCommand_initTelemetry() {
|
|
81
85
|
this.telemetry.push((args) => {
|
|
@@ -32,18 +32,53 @@ class SpoServicePrincipalGrantRevokeCommand extends SpoCommand {
|
|
|
32
32
|
await logger.logToStderr(`Retrieving request digest...`);
|
|
33
33
|
}
|
|
34
34
|
const reqDigest = await spo.getRequestDigest(spoAdminUrl);
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
35
|
+
if (args.options.scope) {
|
|
36
|
+
// revoke a single scope
|
|
37
|
+
// #1 get the grant
|
|
38
|
+
const getGrantRequestOptions = {
|
|
39
|
+
url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
40
|
+
headers: {
|
|
41
|
+
'X-RequestDigest': reqDigest.FormDigestValue
|
|
42
|
+
},
|
|
43
|
+
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="2" ObjectPathId="1" /><ObjectPath Id="4" ObjectPathId="3" /><ObjectPath Id="6" ObjectPathId="5" /><Query Id="7" ObjectPathId="5"><Query SelectAllProperties="true"><Properties /></Query></Query></Actions><ObjectPaths><Constructor Id="1" TypeId="{104e8f06-1e00-4675-99c6-1b9b504ed8d8}" /><Property Id="3" ParentId="1" Name="PermissionGrants" /><Method Id="5" ParentId="3" Name="GetByObjectId"><Parameters><Parameter Type="String">${formatting.escapeXml(args.options.id)}</Parameter></Parameters></Method></ObjectPaths></Request>`
|
|
44
|
+
};
|
|
45
|
+
const grantRequestRes = await request.post(getGrantRequestOptions);
|
|
46
|
+
const grantRequestJson = JSON.parse(grantRequestRes);
|
|
47
|
+
const responseInfo = grantRequestJson[0];
|
|
48
|
+
if (responseInfo.ErrorInfo) {
|
|
49
|
+
throw responseInfo.ErrorInfo.ErrorMessage;
|
|
50
|
+
}
|
|
51
|
+
const grantInfo = grantRequestJson.pop();
|
|
52
|
+
// #2 remove the scope from the grant
|
|
53
|
+
const removeScopeRequestOptions = {
|
|
54
|
+
url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
55
|
+
headers: {
|
|
56
|
+
'X-RequestDigest': reqDigest.FormDigestValue
|
|
57
|
+
},
|
|
58
|
+
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="9" ObjectPathId="8" /><Method Name="Remove" Id="10" ObjectPathId="8"><Parameters><Parameter Type="String">${grantInfo.ClientId}</Parameter><Parameter Type="String">Microsoft Graph</Parameter><Parameter Type="String">${formatting.escapeXml(args.options.scope)}</Parameter></Parameters></Method></Actions><ObjectPaths><Property Id="8" ParentId="1" Name="GrantManager" /><Constructor Id="1" TypeId="{104e8f06-1e00-4675-99c6-1b9b504ed8d8}" /></ObjectPaths></Request>`
|
|
59
|
+
};
|
|
60
|
+
const removeScopeRes = await request.post(removeScopeRequestOptions);
|
|
61
|
+
const removeScopeResJson = JSON.parse(removeScopeRes);
|
|
62
|
+
const removeScopeResponse = removeScopeResJson[0];
|
|
63
|
+
if (removeScopeResponse.ErrorInfo) {
|
|
64
|
+
throw removeScopeResponse.ErrorInfo.ErrorMessage;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
// revoke the whole grant
|
|
69
|
+
const requestOptions = {
|
|
70
|
+
url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
71
|
+
headers: {
|
|
72
|
+
'X-RequestDigest': reqDigest.FormDigestValue
|
|
73
|
+
},
|
|
74
|
+
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="10" ObjectPathId="9" /><ObjectPath Id="12" ObjectPathId="11" /><ObjectPath Id="14" ObjectPathId="13" /><Method Name="DeleteObject" Id="15" ObjectPathId="13" /><Query Id="16" ObjectPathId="13"><Query SelectAllProperties="true"><Properties /></Query></Query></Actions><ObjectPaths><Constructor Id="9" TypeId="{104e8f06-1e00-4675-99c6-1b9b504ed8d8}" /><Property Id="11" ParentId="9" Name="PermissionGrants" /><Method Id="13" ParentId="11" Name="GetByObjectId"><Parameters><Parameter Type="String">${formatting.escapeXml(args.options.id)}</Parameter></Parameters></Method></ObjectPaths></Request>`
|
|
75
|
+
};
|
|
76
|
+
const res = await request.post(requestOptions);
|
|
77
|
+
const json = JSON.parse(res);
|
|
78
|
+
const response = json[0];
|
|
79
|
+
if (response.ErrorInfo) {
|
|
80
|
+
throw response.ErrorInfo.ErrorMessage;
|
|
81
|
+
}
|
|
47
82
|
}
|
|
48
83
|
}
|
|
49
84
|
catch (err) {
|
|
@@ -54,6 +89,8 @@ class SpoServicePrincipalGrantRevokeCommand extends SpoCommand {
|
|
|
54
89
|
_SpoServicePrincipalGrantRevokeCommand_instances = new WeakSet(), _SpoServicePrincipalGrantRevokeCommand_initOptions = function _SpoServicePrincipalGrantRevokeCommand_initOptions() {
|
|
55
90
|
this.options.unshift({
|
|
56
91
|
option: '-i, --id <id>'
|
|
92
|
+
}, {
|
|
93
|
+
option: '-s, --scope [scope]'
|
|
57
94
|
});
|
|
58
95
|
};
|
|
59
96
|
export default new SpoServicePrincipalGrantRevokeCommand();
|
|
@@ -33,12 +33,13 @@ class SpoSiteAddCommand extends SpoCommand {
|
|
|
33
33
|
}
|
|
34
34
|
async commandAction(logger, args) {
|
|
35
35
|
const isClassicSite = args.options.type === 'ClassicSite';
|
|
36
|
-
|
|
37
|
-
await this.createClassicSite(logger, args)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
await this.
|
|
36
|
+
const siteUrl = isClassicSite
|
|
37
|
+
? await this.createClassicSite(logger, args)
|
|
38
|
+
: await this.createModernSite(logger, args);
|
|
39
|
+
if (siteUrl && args.options.withAppCatalog) {
|
|
40
|
+
await this.addAppCatalog(siteUrl, logger);
|
|
41
41
|
}
|
|
42
|
+
await logger.log(siteUrl);
|
|
42
43
|
}
|
|
43
44
|
async createModernSite(logger, args) {
|
|
44
45
|
const isTeamSite = args.options.type !== 'CommunicationSite';
|
|
@@ -132,19 +133,18 @@ class SpoSiteAddCommand extends SpoCommand {
|
|
|
132
133
|
if (response.ErrorMessage !== null) {
|
|
133
134
|
throw response.ErrorMessage;
|
|
134
135
|
}
|
|
135
|
-
|
|
136
|
+
return response.SiteUrl;
|
|
136
137
|
}
|
|
137
138
|
else {
|
|
138
|
-
if (response.SiteStatus
|
|
139
|
-
await logger.log(response.SiteUrl);
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
139
|
+
if (response.SiteStatus !== 2) {
|
|
142
140
|
throw 'An error has occurred while creating the site';
|
|
143
141
|
}
|
|
142
|
+
return response.SiteUrl;
|
|
144
143
|
}
|
|
145
144
|
}
|
|
146
145
|
catch (err) {
|
|
147
146
|
this.handleRejectedODataJsonPromise(err);
|
|
147
|
+
return;
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
async createClassicSite(logger, args) {
|
|
@@ -195,8 +195,8 @@ class SpoSiteAddCommand extends SpoCommand {
|
|
|
195
195
|
}
|
|
196
196
|
const operation = json[json.length - 1];
|
|
197
197
|
const isComplete = operation.IsComplete;
|
|
198
|
-
if (!args.options.wait || isComplete) {
|
|
199
|
-
return;
|
|
198
|
+
if ((!args.options.wait && !args.options.withAppCatalog) || isComplete) {
|
|
199
|
+
return args.options.url;
|
|
200
200
|
}
|
|
201
201
|
await new Promise((resolve, reject) => {
|
|
202
202
|
setTimeout(() => {
|
|
@@ -212,9 +212,11 @@ class SpoSiteAddCommand extends SpoCommand {
|
|
|
212
212
|
});
|
|
213
213
|
}, operation.PollingInterval);
|
|
214
214
|
});
|
|
215
|
+
return args.options.url;
|
|
215
216
|
}
|
|
216
217
|
catch (err) {
|
|
217
218
|
this.handleRejectedPromise(err);
|
|
219
|
+
return;
|
|
218
220
|
}
|
|
219
221
|
}
|
|
220
222
|
async siteExists(url, logger) {
|
|
@@ -304,6 +306,34 @@ class SpoSiteAddCommand extends SpoCommand {
|
|
|
304
306
|
}, operation.PollingInterval);
|
|
305
307
|
});
|
|
306
308
|
}
|
|
309
|
+
async addAppCatalog(url, logger) {
|
|
310
|
+
try {
|
|
311
|
+
this.spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
|
|
312
|
+
this.context = await spo.ensureFormDigest(this.spoAdminUrl, logger, this.context, this.debug);
|
|
313
|
+
if (this.verbose) {
|
|
314
|
+
await logger.logToStderr(`Adding site collection app catalog...`);
|
|
315
|
+
}
|
|
316
|
+
const requestOptions = {
|
|
317
|
+
url: `${this.spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
318
|
+
headers: {
|
|
319
|
+
'X-RequestDigest': this.context.FormDigestValue
|
|
320
|
+
},
|
|
321
|
+
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="38" ObjectPathId="37" /><ObjectPath Id="40" ObjectPathId="39" /><ObjectPath Id="42" ObjectPathId="41" /><ObjectPath Id="44" ObjectPathId="43" /><ObjectPath Id="46" ObjectPathId="45" /><ObjectPath Id="48" ObjectPathId="47" /></Actions><ObjectPaths><Constructor Id="37" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /><Method Id="39" ParentId="37" Name="GetSiteByUrl"><Parameters><Parameter Type="String">${formatting.escapeXml(url)}</Parameter></Parameters></Method><Property Id="41" ParentId="39" Name="RootWeb" /><Property Id="43" ParentId="41" Name="TenantAppCatalog" /><Property Id="45" ParentId="43" Name="SiteCollectionAppCatalogsSites" /><Method Id="47" ParentId="45" Name="Add"><Parameters><Parameter Type="String">${formatting.escapeXml(url)}</Parameter></Parameters></Method></ObjectPaths></Request>`
|
|
322
|
+
};
|
|
323
|
+
const response = await request.post(requestOptions);
|
|
324
|
+
const json = JSON.parse(response);
|
|
325
|
+
const responseContents = json[0];
|
|
326
|
+
if (responseContents.ErrorInfo) {
|
|
327
|
+
throw responseContents.ErrorInfo.ErrorMessage;
|
|
328
|
+
}
|
|
329
|
+
if (this.verbose) {
|
|
330
|
+
await logger.logToStderr('Site collection app catalog created');
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
catch (err) {
|
|
334
|
+
this.handleRejectedPromise(err);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
307
337
|
}
|
|
308
338
|
_SpoSiteAddCommand_instances = new WeakSet(), _SpoSiteAddCommand_initTelemetry = function _SpoSiteAddCommand_initTelemetry() {
|
|
309
339
|
this.telemetry.push((args) => {
|
|
@@ -316,6 +346,7 @@ _SpoSiteAddCommand_instances = new WeakSet(), _SpoSiteAddCommand_initTelemetry =
|
|
|
316
346
|
telemetryProps.isPublic = args.options.isPublic || false;
|
|
317
347
|
telemetryProps.lcid = args.options.lcid;
|
|
318
348
|
telemetryProps.owners = typeof args.options.owners !== 'undefined';
|
|
349
|
+
telemetryProps.withAppCatalog = args.options.withAppCatalog || false;
|
|
319
350
|
if (isCommunicationSite) {
|
|
320
351
|
telemetryProps.shareByEmailEnabled = args.options.shareByEmailEnabled || false;
|
|
321
352
|
telemetryProps.siteDesign = args.options.siteDesign;
|
|
@@ -373,6 +404,8 @@ _SpoSiteAddCommand_instances = new WeakSet(), _SpoSiteAddCommand_initTelemetry =
|
|
|
373
404
|
option: '--storageQuotaWarningLevel [storageQuotaWarningLevel]'
|
|
374
405
|
}, {
|
|
375
406
|
option: '--removeDeletedSite'
|
|
407
|
+
}, {
|
|
408
|
+
option: '--withAppCatalog'
|
|
376
409
|
}, {
|
|
377
410
|
option: '--wait'
|
|
378
411
|
});
|
|
@@ -36,8 +36,12 @@ class SpoSiteScriptGetCommand extends SpoCommand {
|
|
|
36
36
|
data: { id: args.options.id },
|
|
37
37
|
responseType: 'json'
|
|
38
38
|
};
|
|
39
|
-
const
|
|
40
|
-
|
|
39
|
+
const response = await request.post(requestOptions);
|
|
40
|
+
if (args.options.content === true) {
|
|
41
|
+
await logger.log(JSON.parse(response.Content));
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
await logger.log(response);
|
|
41
45
|
}
|
|
42
46
|
catch (err) {
|
|
43
47
|
this.handleRejectedODataJsonPromise(err);
|
|
@@ -47,6 +51,8 @@ class SpoSiteScriptGetCommand extends SpoCommand {
|
|
|
47
51
|
_SpoSiteScriptGetCommand_instances = new WeakSet(), _SpoSiteScriptGetCommand_initOptions = function _SpoSiteScriptGetCommand_initOptions() {
|
|
48
52
|
this.options.unshift({
|
|
49
53
|
option: '-i, --id <id>'
|
|
54
|
+
}, {
|
|
55
|
+
option: '-c, --content'
|
|
50
56
|
});
|
|
51
57
|
}, _SpoSiteScriptGetCommand_initValidators = function _SpoSiteScriptGetCommand_initValidators() {
|
|
52
58
|
this.validators.push(async (args) => {
|
|
@@ -9,6 +9,7 @@ import { spo } from '../../../../utils/spo.js';
|
|
|
9
9
|
import { validation } from '../../../../utils/validation.js';
|
|
10
10
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
11
11
|
import commands from '../../commands.js';
|
|
12
|
+
import { setTimeout } from 'timers/promises';
|
|
12
13
|
class SpoTenantRecycleBinItemRestoreCommand extends SpoCommand {
|
|
13
14
|
get name() {
|
|
14
15
|
return commands.TENANT_RECYCLEBINITEM_RESTORE;
|
|
@@ -36,13 +37,29 @@ class SpoTenantRecycleBinItemRestoreCommand extends SpoCommand {
|
|
|
36
37
|
siteUrl: args.options.siteUrl
|
|
37
38
|
}
|
|
38
39
|
};
|
|
39
|
-
const
|
|
40
|
-
|
|
40
|
+
const response = await request.post(requestOptions);
|
|
41
|
+
let responseContent = JSON.parse(response);
|
|
42
|
+
if (args.options.wait && !responseContent.IsComplete) {
|
|
43
|
+
responseContent = await this.waitUntilTenantRestoreFinished(responseContent.PollingInterval, requestOptions, logger);
|
|
44
|
+
}
|
|
45
|
+
await logger.log(responseContent);
|
|
41
46
|
}
|
|
42
47
|
catch (err) {
|
|
43
48
|
this.handleRejectedODataJsonPromise(err);
|
|
44
49
|
}
|
|
45
50
|
}
|
|
51
|
+
async waitUntilTenantRestoreFinished(pollingInterval, requestOptions, logger) {
|
|
52
|
+
if (this.verbose) {
|
|
53
|
+
await logger.logToStderr(`Site collection still restoring. Retrying in ${pollingInterval / 1000} seconds...`);
|
|
54
|
+
}
|
|
55
|
+
await setTimeout(pollingInterval);
|
|
56
|
+
const response = await request.post(requestOptions);
|
|
57
|
+
const responseContent = JSON.parse(response);
|
|
58
|
+
if (responseContent.IsComplete) {
|
|
59
|
+
return responseContent;
|
|
60
|
+
}
|
|
61
|
+
return await this.waitUntilTenantRestoreFinished(responseContent.PollingInterval, requestOptions, logger);
|
|
62
|
+
}
|
|
46
63
|
}
|
|
47
64
|
_SpoTenantRecycleBinItemRestoreCommand_instances = new WeakSet(), _SpoTenantRecycleBinItemRestoreCommand_initTelemetry = function _SpoTenantRecycleBinItemRestoreCommand_initTelemetry() {
|
|
48
65
|
this.telemetry.push((args) => {
|