@pnp/cli-microsoft365 7.10.0-beta.172f827 → 7.10.0-beta.ebb7426

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.
@@ -430,33 +430,35 @@ class SpoSiteSetCommand extends SpoCommand {
430
430
  _SpoSiteSetCommand_instances = new WeakSet(), _SpoSiteSetCommand_initTelemetry = function _SpoSiteSetCommand_initTelemetry() {
431
431
  this.telemetry.push((args) => {
432
432
  Object.assign(this.telemetryProperties, {
433
- classification: typeof args.options.classification === 'string',
434
- disableFlows: args.options.disableFlows,
435
- socialBarOnSitePagesDisabled: args.options.socialBarOnSitePagesDisabled,
436
- isPublic: args.options.isPublic,
433
+ classification: typeof args.options.classification !== 'undefined',
434
+ disableFlows: !!args.options.disableFlows,
435
+ socialBarOnSitePagesDisabled: !!args.options.socialBarOnSitePagesDisabled,
436
+ isPublic: !!args.options.isPublic,
437
437
  owners: typeof args.options.owners !== 'undefined',
438
- shareByEmailEnabled: args.options.shareByEmailEnabled,
439
- title: typeof args.options.title === 'string',
440
- description: typeof args.options.description === 'string',
441
- siteDesignId: typeof args.options.siteDesignId !== undefined,
442
- sharingCapabilities: args.options.sharingCapability,
438
+ shareByEmailEnabled: !!args.options.shareByEmailEnabled,
439
+ title: typeof args.options.title !== 'undefined',
440
+ description: typeof args.options.description !== 'undefined',
441
+ siteDesignId: typeof args.options.siteDesignId !== 'undefined',
442
+ sharingCapabilities: typeof args.options.sharingCapability !== 'undefined',
443
443
  siteLogoUrl: typeof args.options.siteLogoUrl !== 'undefined',
444
444
  siteThumbnailUrl: typeof args.options.siteThumbnailUrl !== 'undefined',
445
- resourceQuota: args.options.resourceQuota,
446
- resourceQuotaWarningLevel: args.options.resourceQuotaWarningLevel,
447
- storageQuota: args.options.storageQuota,
448
- storageQuotaWarningLevel: args.options.storageQuotaWarningLevel,
449
- allowSelfServiceUpgrade: args.options.allowSelfServiceUpgrade,
450
- lockState: args.options.lockState,
451
- noScriptSite: args.options.noScriptSite,
452
- wait: args.options.wait === true
445
+ resourceQuota: typeof args.options.resourceQuota !== 'undefined',
446
+ resourceQuotaWarningLevel: typeof args.options.resourceQuotaWarningLevel !== 'undefined',
447
+ storageQuota: typeof args.options.storageQuota !== 'undefined',
448
+ storageQuotaWarningLevel: typeof args.options.storageQuotaWarningLevel !== 'undefined',
449
+ allowSelfServiceUpgrade: !!args.options.allowSelfServiceUpgrade,
450
+ lockState: typeof args.options.lockState !== 'undefined',
451
+ noScriptSite: !!args.options.noScriptSite,
452
+ wait: !!args.options.wait
453
453
  });
454
454
  });
455
455
  }, _SpoSiteSetCommand_initOptions = function _SpoSiteSetCommand_initOptions() {
456
456
  this.options.unshift({
457
457
  option: '-u, --url <url>'
458
458
  }, {
459
- option: '-i, --id [id]'
459
+ option: '-t, --title [title]'
460
+ }, {
461
+ option: '-d, --description [description]'
460
462
  }, {
461
463
  option: '--classification [classification]'
462
464
  }, {
@@ -476,16 +478,12 @@ _SpoSiteSetCommand_instances = new WeakSet(), _SpoSiteSetCommand_initTelemetry =
476
478
  }, {
477
479
  option: '--siteDesignId [siteDesignId]'
478
480
  }, {
479
- option: '--title [title]'
480
- }, {
481
- option: '--description [description]'
481
+ option: '--sharingCapability [sharingCapability]',
482
+ autocomplete: this.sharingCapabilities
482
483
  }, {
483
484
  option: '--siteLogoUrl [siteLogoUrl]'
484
485
  }, {
485
486
  option: '--siteThumbnailUrl [siteThumbnailUrl]'
486
- }, {
487
- option: '--sharingCapability [sharingCapability]',
488
- autocomplete: this.sharingCapabilities
489
487
  }, {
490
488
  option: '--resourceQuota [resourceQuota]'
491
489
  }, {
@@ -0,0 +1,99 @@
1
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
+ };
6
+ var _SpoTenantSiteArchiveCommand_instances, _SpoTenantSiteArchiveCommand_initTelemetry, _SpoTenantSiteArchiveCommand_initOptions, _SpoTenantSiteArchiveCommand_initValidators, _SpoTenantSiteArchiveCommand_initTypes;
7
+ import { cli } from '../../../../cli/cli.js';
8
+ import config from '../../../../config.js';
9
+ import request from '../../../../request.js';
10
+ import { validation } from '../../../../utils/validation.js';
11
+ import { spo } from '../../../../utils/spo.js';
12
+ import SpoCommand from '../../../base/SpoCommand.js';
13
+ import commands from '../../commands.js';
14
+ class SpoTenantSiteArchiveCommand extends SpoCommand {
15
+ get name() {
16
+ return commands.TENANT_SITE_ARCHIVE;
17
+ }
18
+ get description() {
19
+ return 'Archives a site collection';
20
+ }
21
+ constructor() {
22
+ super();
23
+ _SpoTenantSiteArchiveCommand_instances.add(this);
24
+ __classPrivateFieldGet(this, _SpoTenantSiteArchiveCommand_instances, "m", _SpoTenantSiteArchiveCommand_initTelemetry).call(this);
25
+ __classPrivateFieldGet(this, _SpoTenantSiteArchiveCommand_instances, "m", _SpoTenantSiteArchiveCommand_initOptions).call(this);
26
+ __classPrivateFieldGet(this, _SpoTenantSiteArchiveCommand_instances, "m", _SpoTenantSiteArchiveCommand_initValidators).call(this);
27
+ __classPrivateFieldGet(this, _SpoTenantSiteArchiveCommand_instances, "m", _SpoTenantSiteArchiveCommand_initTypes).call(this);
28
+ }
29
+ async commandAction(logger, args) {
30
+ const archiveSite = async () => {
31
+ try {
32
+ if (this.verbose) {
33
+ await logger.logToStderr(`Archiving site ${args.options.url}...`);
34
+ }
35
+ const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.verbose);
36
+ const reqDigest = await spo.getRequestDigest(spoAdminUrl);
37
+ const requestOptions = {
38
+ url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
39
+ headers: {
40
+ 'X-RequestDigest': reqDigest.FormDigestValue
41
+ },
42
+ 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">
43
+ <Actions>
44
+ <ObjectPath Id="2" ObjectPathId="1" />
45
+ <ObjectPath Id="4" ObjectPathId="3" />
46
+ <Query Id="5" ObjectPathId="3">
47
+ <Query SelectAllProperties="true">
48
+ <Properties />
49
+ </Query>
50
+ </Query>
51
+ </Actions>
52
+ <ObjectPaths>
53
+ <Constructor Id="1" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" />
54
+ <Method Id="3" ParentId="1" Name="ArchiveSiteByUrl">
55
+ <Parameters>
56
+ <Parameter Type="String">${args.options.url}</Parameter>
57
+ </Parameters>
58
+ </Method>
59
+ </ObjectPaths>
60
+ </Request>`
61
+ };
62
+ const res = await request.post(requestOptions);
63
+ const json = JSON.parse(res);
64
+ const response = json[0];
65
+ if (response.ErrorInfo) {
66
+ throw response.ErrorInfo.ErrorMessage;
67
+ }
68
+ }
69
+ catch (err) {
70
+ this.handleRejectedPromise(err);
71
+ }
72
+ };
73
+ if (args.options.force) {
74
+ await archiveSite();
75
+ }
76
+ else {
77
+ const result = await cli.promptForConfirmation({ message: `Are you sure you want to archive site '${args.options.url}'?` });
78
+ if (result) {
79
+ await archiveSite();
80
+ }
81
+ }
82
+ }
83
+ }
84
+ _SpoTenantSiteArchiveCommand_instances = new WeakSet(), _SpoTenantSiteArchiveCommand_initTelemetry = function _SpoTenantSiteArchiveCommand_initTelemetry() {
85
+ this.telemetry.push((args) => {
86
+ Object.assign(this.telemetryProperties, {
87
+ force: !!args.options.force
88
+ });
89
+ });
90
+ }, _SpoTenantSiteArchiveCommand_initOptions = function _SpoTenantSiteArchiveCommand_initOptions() {
91
+ this.options.unshift({ option: '-u, --url <url>' }, { option: '-f, --force' });
92
+ }, _SpoTenantSiteArchiveCommand_initValidators = function _SpoTenantSiteArchiveCommand_initValidators() {
93
+ this.validators.push(async (args) => validation.isValidSharePointUrl(args.options.url));
94
+ }, _SpoTenantSiteArchiveCommand_initTypes = function _SpoTenantSiteArchiveCommand_initTypes() {
95
+ this.types.string.push('url');
96
+ this.types.boolean.push('force');
97
+ };
98
+ export default new SpoTenantSiteArchiveCommand();
99
+ //# sourceMappingURL=tenant-site-archive.js.map
@@ -0,0 +1,98 @@
1
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
+ };
6
+ var _SpoTenantSiteUnarchiveCommand_instances, _SpoTenantSiteUnarchiveCommand_initTelemetry, _SpoTenantSiteUnarchiveCommand_initOptions, _SpoTenantSiteUnarchiveCommand_initValidators, _SpoTenantSiteUnarchiveCommand_initTypes;
7
+ import { cli } from '../../../../cli/cli.js';
8
+ import config from '../../../../config.js';
9
+ import request from '../../../../request.js';
10
+ import { spo } from '../../../../utils/spo.js';
11
+ import { validation } from '../../../../utils/validation.js';
12
+ import SpoCommand from '../../../base/SpoCommand.js';
13
+ import commands from '../../commands.js';
14
+ class SpoTenantSiteUnarchiveCommand extends SpoCommand {
15
+ get name() {
16
+ return commands.TENANT_SITE_UNARCHIVE;
17
+ }
18
+ get description() {
19
+ return 'Unarchives a site collection';
20
+ }
21
+ constructor() {
22
+ super();
23
+ _SpoTenantSiteUnarchiveCommand_instances.add(this);
24
+ __classPrivateFieldGet(this, _SpoTenantSiteUnarchiveCommand_instances, "m", _SpoTenantSiteUnarchiveCommand_initTelemetry).call(this);
25
+ __classPrivateFieldGet(this, _SpoTenantSiteUnarchiveCommand_instances, "m", _SpoTenantSiteUnarchiveCommand_initOptions).call(this);
26
+ __classPrivateFieldGet(this, _SpoTenantSiteUnarchiveCommand_instances, "m", _SpoTenantSiteUnarchiveCommand_initValidators).call(this);
27
+ __classPrivateFieldGet(this, _SpoTenantSiteUnarchiveCommand_instances, "m", _SpoTenantSiteUnarchiveCommand_initTypes).call(this);
28
+ }
29
+ async commandAction(logger, args) {
30
+ if (args.options.force) {
31
+ await this.unarchiveSite(logger, args.options.url);
32
+ }
33
+ else {
34
+ const result = await cli.promptForConfirmation({ message: `Are you sure you want to unarchive site '${args.options.url}'? This may cause additional billing costs.` });
35
+ if (result) {
36
+ await this.unarchiveSite(logger, args.options.url);
37
+ }
38
+ }
39
+ }
40
+ async unarchiveSite(logger, url) {
41
+ if (this.verbose) {
42
+ await logger.logToStderr(`Unarchiving site '${url}'...`);
43
+ }
44
+ try {
45
+ const adminCenterUrl = await spo.getSpoAdminUrl(logger, this.verbose);
46
+ const requestDigest = await spo.getRequestDigest(adminCenterUrl);
47
+ const requestOptions = {
48
+ url: `${adminCenterUrl}/_vti_bin/client.svc/ProcessQuery`,
49
+ headers: {
50
+ 'X-RequestDigest': requestDigest.FormDigestValue
51
+ },
52
+ 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">
53
+ <Actions>
54
+ <ObjectPath Id="2" ObjectPathId="1" />
55
+ <ObjectPath Id="4" ObjectPathId="3" />
56
+ </Actions>
57
+ <ObjectPaths>
58
+ <Constructor Id="1" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" />
59
+ <Method Id="3" ParentId="1" Name="UnarchiveSiteByUrl">
60
+ <Parameters>
61
+ <Parameter Type="String">${url}</Parameter>
62
+ </Parameters>
63
+ </Method>
64
+ </ObjectPaths>
65
+ </Request>`
66
+ };
67
+ const response = await request.post(requestOptions);
68
+ const json = JSON.parse(response);
69
+ const responseContent = json[0];
70
+ if (responseContent.ErrorInfo) {
71
+ throw responseContent.ErrorInfo.ErrorMessage;
72
+ }
73
+ }
74
+ catch (err) {
75
+ this.handleRejectedPromise(err);
76
+ }
77
+ }
78
+ }
79
+ _SpoTenantSiteUnarchiveCommand_instances = new WeakSet(), _SpoTenantSiteUnarchiveCommand_initTelemetry = function _SpoTenantSiteUnarchiveCommand_initTelemetry() {
80
+ this.telemetry.push((args) => {
81
+ Object.assign(this.telemetryProperties, {
82
+ force: !!args.options.force
83
+ });
84
+ });
85
+ }, _SpoTenantSiteUnarchiveCommand_initOptions = function _SpoTenantSiteUnarchiveCommand_initOptions() {
86
+ this.options.unshift({
87
+ option: '-u, --url <url>'
88
+ }, {
89
+ option: '-f, --force'
90
+ });
91
+ }, _SpoTenantSiteUnarchiveCommand_initValidators = function _SpoTenantSiteUnarchiveCommand_initValidators() {
92
+ this.validators.push(async (args) => validation.isValidSharePointUrl(args.options.url));
93
+ }, _SpoTenantSiteUnarchiveCommand_initTypes = function _SpoTenantSiteUnarchiveCommand_initTypes() {
94
+ this.types.string.push('url');
95
+ this.types.boolean.push('force');
96
+ };
97
+ export default new SpoTenantSiteUnarchiveCommand();
98
+ //# sourceMappingURL=tenant-site-unarchive.js.map
@@ -312,6 +312,8 @@ export default {
312
312
  TENANT_RECYCLEBINITEM_RESTORE: `${prefix} tenant recyclebinitem restore`,
313
313
  TENANT_SETTINGS_LIST: `${prefix} tenant settings list`,
314
314
  TENANT_SETTINGS_SET: `${prefix} tenant settings set`,
315
+ TENANT_SITE_ARCHIVE: `${prefix} tenant site archive`,
316
+ TENANT_SITE_UNARCHIVE: `${prefix} tenant site unarchive`,
315
317
  TERM_ADD: `${prefix} term add`,
316
318
  TERM_GET: `${prefix} term get`,
317
319
  TERM_LIST: `${prefix} term list`,
@@ -0,0 +1,63 @@
1
+ import Global from '/docs/cmd/_global.mdx';
2
+ import Tabs from '@theme/Tabs';
3
+ import TabItem from '@theme/TabItem';
4
+
5
+ # spo tenant site archive
6
+
7
+ Archives a site collection
8
+
9
+ ## Usage
10
+
11
+ ```sh
12
+ m365 spo tenant site archive [options]
13
+ ```
14
+
15
+ ## Options
16
+
17
+ ```md definition-list
18
+ `-u, --url <url>`
19
+ : URL of the site collection.
20
+
21
+ `-f, --force`
22
+ : Don't prompt for confirmation.
23
+ ```
24
+
25
+ <Global />
26
+
27
+ ## Remarks
28
+
29
+ :::info
30
+
31
+ To use this command, you must be a Global or SharePoint administrator.
32
+
33
+ :::
34
+
35
+ :::note
36
+
37
+ After running this command, it may take a few minutes for the site to be fully archived.
38
+
39
+ :::
40
+
41
+
42
+ ## Examples
43
+
44
+ Archive a specific SharePoint site collection
45
+
46
+ ```sh
47
+ m365 spo tenant site archive --url "https://contoso.sharepoint.com/sites/Marketing"
48
+ ```
49
+
50
+ Archive a specific SharePoint site collection without confirmation prompt
51
+
52
+ ```sh
53
+ m365 spo tenant site archive --url "https://contoso.sharepoint.com/sites/Marketing" --force
54
+ ```
55
+
56
+ ## Response
57
+
58
+ The command won't return a response on success.
59
+
60
+ ## More information
61
+
62
+ - Pricing model for Microsoft 365 Archive: [https://learn.microsoft.com/microsoft-365/archive/archive-pricing](https://learn.microsoft.com/microsoft-365/archive/archive-pricing)
63
+ - Set up Microsoft 365 Archive: [https://learn.microsoft.com/microsoft-365/archive/archive-setup](https://learn.microsoft.com/microsoft-365/archive/archive-setup)
@@ -0,0 +1,67 @@
1
+ import Global from '/docs/cmd/_global.mdx';
2
+ import Tabs from '@theme/Tabs';
3
+ import TabItem from '@theme/TabItem';
4
+
5
+ # spo tenant site unarchive
6
+
7
+ Unarchives a site collection
8
+
9
+ ## Usage
10
+
11
+ ```sh
12
+ m365 spo tenant site unarchive [options]
13
+ ```
14
+
15
+ ## Options
16
+
17
+ ```md definition-list
18
+ `-u, --url <url>`
19
+ : URL of the site collection.
20
+
21
+ `-f, --force`
22
+ : Don't prompt for confirmation.
23
+ ```
24
+
25
+ <Global />
26
+
27
+ ## Remarks
28
+
29
+ :::info
30
+
31
+ To use this command, you must be a Global or SharePoint administrator.
32
+
33
+ :::
34
+
35
+ :::warning
36
+
37
+ If a site remains archived for more than **seven days**, the reactivation fee will be calculated based on the entire storage capacity of the site.
38
+
39
+ :::
40
+
41
+ :::note
42
+
43
+ After running this command, it may take a few minutes for the site to be fully restored.
44
+
45
+ :::
46
+
47
+ ## Examples
48
+
49
+ Unarchive a specific site collection.
50
+
51
+ ```sh
52
+ m365 spo tenant site unarchive --url "https://contoso.sharepoint.com/sites/Marketing"
53
+ ```
54
+
55
+ Unarchive a specific site collection without confirmation prompt.
56
+
57
+ ```sh
58
+ m365 spo tenant site unarchive --url "https://contoso.sharepoint.com/sites/Marketing" --force
59
+ ```
60
+
61
+ ## Response
62
+
63
+ The command won't return a response on success.
64
+
65
+ ## More information
66
+
67
+ - Pricing model for Microsoft 365 Archive: [https://learn.microsoft.com/microsoft-365/archive/archive-pricing](https://learn.microsoft.com/microsoft-365/archive/archive-pricing)