@pnp/cli-microsoft365 7.10.0-beta.172f827 → 7.10.0-beta.4ffb095
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 -1
- package/allCommandsFull.json +1 -1
- package/dist/m365/spo/commands/site/site-admin-list.js +144 -0
- package/dist/m365/spo/commands/site/site-set.js +22 -24
- package/dist/m365/spo/commands/tenant/tenant-site-archive.js +99 -0
- package/dist/m365/spo/commands/tenant/tenant-site-unarchive.js +98 -0
- package/dist/m365/spo/commands.js +3 -0
- package/docs/docs/cmd/entra/app/app-permission-remove.mdx +4 -4
- package/docs/docs/cmd/spo/site/site-admin-list.mdx +115 -0
- package/docs/docs/cmd/spo/tenant/tenant-site-archive.mdx +63 -0
- package/docs/docs/cmd/spo/tenant/tenant-site-unarchive.mdx +67 -0
- package/npm-shrinkwrap.json +181 -90
- package/package.json +16 -15
|
@@ -0,0 +1,144 @@
|
|
|
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 _SpoSiteAdminListCommand_instances, _SpoSiteAdminListCommand_initTelemetry, _SpoSiteAdminListCommand_initOptions, _SpoSiteAdminListCommand_initValidators, _SpoSiteAdminListCommand_initTypes;
|
|
7
|
+
import request from '../../../../request.js';
|
|
8
|
+
import { spo } from '../../../../utils/spo.js';
|
|
9
|
+
import { validation } from '../../../../utils/validation.js';
|
|
10
|
+
import SpoCommand from '../../../base/SpoCommand.js';
|
|
11
|
+
import commands from '../../commands.js';
|
|
12
|
+
import { ListPrincipalType } from '../list/ListPrincipalType.js';
|
|
13
|
+
class SpoSiteAdminListCommand extends SpoCommand {
|
|
14
|
+
get name() {
|
|
15
|
+
return commands.SITE_ADMIN_LIST;
|
|
16
|
+
}
|
|
17
|
+
get description() {
|
|
18
|
+
return 'Lists all administrators of a specific SharePoint site';
|
|
19
|
+
}
|
|
20
|
+
constructor() {
|
|
21
|
+
super();
|
|
22
|
+
_SpoSiteAdminListCommand_instances.add(this);
|
|
23
|
+
__classPrivateFieldGet(this, _SpoSiteAdminListCommand_instances, "m", _SpoSiteAdminListCommand_initTelemetry).call(this);
|
|
24
|
+
__classPrivateFieldGet(this, _SpoSiteAdminListCommand_instances, "m", _SpoSiteAdminListCommand_initOptions).call(this);
|
|
25
|
+
__classPrivateFieldGet(this, _SpoSiteAdminListCommand_instances, "m", _SpoSiteAdminListCommand_initValidators).call(this);
|
|
26
|
+
__classPrivateFieldGet(this, _SpoSiteAdminListCommand_instances, "m", _SpoSiteAdminListCommand_initTypes).call(this);
|
|
27
|
+
}
|
|
28
|
+
async commandAction(logger, args) {
|
|
29
|
+
try {
|
|
30
|
+
if (args.options.asAdmin) {
|
|
31
|
+
await this.callActionAsAdmin(logger, args);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
await this.callAction(logger, args);
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
this.handleRejectedODataJsonPromise(err);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async callActionAsAdmin(logger, args) {
|
|
41
|
+
if (this.verbose) {
|
|
42
|
+
await logger.logToStderr('Retrieving site administrators as an administrator...');
|
|
43
|
+
}
|
|
44
|
+
const adminUrl = await spo.getSpoAdminUrl(logger, this.debug);
|
|
45
|
+
const siteId = await this.getSiteId(args.options.siteUrl, logger);
|
|
46
|
+
const requestOptions = {
|
|
47
|
+
url: `${adminUrl}/_api/SPO.Tenant/GetSiteAdministrators?siteId='${siteId}'`,
|
|
48
|
+
headers: {
|
|
49
|
+
accept: 'application/json;odata=nometadata',
|
|
50
|
+
'content-type': 'application/json;charset=utf-8'
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const response = await request.post(requestOptions);
|
|
54
|
+
const responseContent = JSON.parse(response);
|
|
55
|
+
const primaryAdminLoginName = await this.getPrimaryAdminLoginNameFromAdmin(adminUrl, siteId);
|
|
56
|
+
const mappedResult = responseContent.value.map((u) => ({
|
|
57
|
+
Id: null,
|
|
58
|
+
Email: u.email,
|
|
59
|
+
LoginName: u.loginName,
|
|
60
|
+
Title: u.name,
|
|
61
|
+
PrincipalType: null,
|
|
62
|
+
PrincipalTypeString: null,
|
|
63
|
+
IsPrimaryAdmin: u.loginName === primaryAdminLoginName
|
|
64
|
+
}));
|
|
65
|
+
await logger.log(mappedResult);
|
|
66
|
+
}
|
|
67
|
+
async getSiteId(siteUrl, logger) {
|
|
68
|
+
const siteGraphId = await spo.getSiteId(siteUrl, logger, this.verbose);
|
|
69
|
+
const match = siteGraphId.match(/,([a-f0-9\-]{36}),/i);
|
|
70
|
+
if (!match) {
|
|
71
|
+
throw `Site with URL ${siteUrl} not found`;
|
|
72
|
+
}
|
|
73
|
+
return match[1];
|
|
74
|
+
}
|
|
75
|
+
async getPrimaryAdminLoginNameFromAdmin(adminUrl, siteId) {
|
|
76
|
+
const requestOptions = {
|
|
77
|
+
url: `${adminUrl}/_api/SPO.Tenant/sites('${siteId}')?$select=OwnerLoginName`,
|
|
78
|
+
headers: {
|
|
79
|
+
accept: 'application/json;odata=nometadata',
|
|
80
|
+
'content-type': 'application/json;charset=utf-8'
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
const response = await request.get(requestOptions);
|
|
84
|
+
const responseContent = JSON.parse(response);
|
|
85
|
+
return responseContent.OwnerLoginName;
|
|
86
|
+
}
|
|
87
|
+
async callAction(logger, args) {
|
|
88
|
+
if (this.verbose) {
|
|
89
|
+
await logger.logToStderr('Retrieving site administrators...');
|
|
90
|
+
}
|
|
91
|
+
const requestOptions = {
|
|
92
|
+
url: `${args.options.siteUrl}/_api/web/siteusers?$filter=IsSiteAdmin eq true`,
|
|
93
|
+
method: 'GET',
|
|
94
|
+
headers: {
|
|
95
|
+
'accept': 'application/json;odata=nometadata'
|
|
96
|
+
},
|
|
97
|
+
responseType: 'json'
|
|
98
|
+
};
|
|
99
|
+
const responseContent = await request.get(requestOptions);
|
|
100
|
+
const primaryOwnerLogin = await this.getPrimaryOwnerLoginFromSite(args.options.siteUrl);
|
|
101
|
+
const mappedResult = responseContent.value.map((u) => ({
|
|
102
|
+
Id: u.Id,
|
|
103
|
+
LoginName: u.LoginName,
|
|
104
|
+
Title: u.Title,
|
|
105
|
+
PrincipalType: u.PrincipalType,
|
|
106
|
+
PrincipalTypeString: ListPrincipalType[u.PrincipalType],
|
|
107
|
+
Email: u.Email,
|
|
108
|
+
IsPrimaryAdmin: u.LoginName === primaryOwnerLogin
|
|
109
|
+
}));
|
|
110
|
+
await logger.log(mappedResult);
|
|
111
|
+
}
|
|
112
|
+
async getPrimaryOwnerLoginFromSite(siteUrl) {
|
|
113
|
+
const requestOptions = {
|
|
114
|
+
url: `${siteUrl}/_api/site/owner`,
|
|
115
|
+
method: 'GET',
|
|
116
|
+
headers: {
|
|
117
|
+
'accept': 'application/json;odata=nometadata'
|
|
118
|
+
},
|
|
119
|
+
responseType: 'json'
|
|
120
|
+
};
|
|
121
|
+
const responseContent = await request.get(requestOptions);
|
|
122
|
+
return responseContent?.LoginName ?? null;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
_SpoSiteAdminListCommand_instances = new WeakSet(), _SpoSiteAdminListCommand_initTelemetry = function _SpoSiteAdminListCommand_initTelemetry() {
|
|
126
|
+
this.telemetry.push((args) => {
|
|
127
|
+
Object.assign(this.telemetryProperties, {
|
|
128
|
+
siteUrl: typeof args.options.siteUrl !== 'undefined',
|
|
129
|
+
asAdmin: !!args.options.asAdmin
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
}, _SpoSiteAdminListCommand_initOptions = function _SpoSiteAdminListCommand_initOptions() {
|
|
133
|
+
this.options.unshift({
|
|
134
|
+
option: '-u, --siteUrl <siteUrl>'
|
|
135
|
+
}, {
|
|
136
|
+
option: '--asAdmin'
|
|
137
|
+
});
|
|
138
|
+
}, _SpoSiteAdminListCommand_initValidators = function _SpoSiteAdminListCommand_initValidators() {
|
|
139
|
+
this.validators.push(async (args) => validation.isValidSharePointUrl(args.options.siteUrl));
|
|
140
|
+
}, _SpoSiteAdminListCommand_initTypes = function _SpoSiteAdminListCommand_initTypes() {
|
|
141
|
+
this.types.string.push('siteUrl');
|
|
142
|
+
};
|
|
143
|
+
export default new SpoSiteAdminListCommand();
|
|
144
|
+
//# sourceMappingURL=site-admin-list.js.map
|
|
@@ -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
|
|
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
|
|
440
|
-
description: typeof args.options.description
|
|
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
|
|
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: '-
|
|
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: '--
|
|
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
|
|
@@ -239,6 +239,7 @@ export default {
|
|
|
239
239
|
SERVICEPRINCIPAL_SET: `${prefix} serviceprincipal set`,
|
|
240
240
|
SET: `${prefix} set`,
|
|
241
241
|
SITE_ADD: `${prefix} site add`,
|
|
242
|
+
SITE_ADMIN_LIST: `${prefix} site admin list`,
|
|
242
243
|
SITE_APPCATALOG_ADD: `${prefix} site appcatalog add`,
|
|
243
244
|
SITE_APPCATALOG_LIST: `${prefix} site appcatalog list`,
|
|
244
245
|
SITE_APPCATALOG_REMOVE: `${prefix} site appcatalog remove`,
|
|
@@ -312,6 +313,8 @@ export default {
|
|
|
312
313
|
TENANT_RECYCLEBINITEM_RESTORE: `${prefix} tenant recyclebinitem restore`,
|
|
313
314
|
TENANT_SETTINGS_LIST: `${prefix} tenant settings list`,
|
|
314
315
|
TENANT_SETTINGS_SET: `${prefix} tenant settings set`,
|
|
316
|
+
TENANT_SITE_ARCHIVE: `${prefix} tenant site archive`,
|
|
317
|
+
TENANT_SITE_UNARCHIVE: `${prefix} tenant site unarchive`,
|
|
315
318
|
TERM_ADD: `${prefix} term add`,
|
|
316
319
|
TERM_GET: `${prefix} term get`,
|
|
317
320
|
TERM_LIST: `${prefix} term list`,
|
|
@@ -14,19 +14,19 @@ m365 entra app permission remove [options]
|
|
|
14
14
|
|
|
15
15
|
```md definition-list
|
|
16
16
|
`-i, --appId [appId]`
|
|
17
|
-
: Client ID of the Microsoft Entra app to
|
|
17
|
+
: Client ID of the Microsoft Entra app to remove the API permissions from. Specify either `appId`, `appName` or `appObjectId`.
|
|
18
18
|
|
|
19
19
|
`--appObjectId [appObjectId]`
|
|
20
|
-
: Object ID of the Microsoft Entra app to
|
|
20
|
+
: Object ID of the Microsoft Entra app to remove the API permissions from. Specify either `appId`, `appName` or `appObjectId`.
|
|
21
21
|
|
|
22
22
|
`-n, --appName [appName]`
|
|
23
23
|
: Display name of the Entra app to remove the API permissions from. Specify either `appId`, `appName` or `appObjectId`.
|
|
24
24
|
|
|
25
25
|
`-a, --applicationPermissions [applicationPermissions]`
|
|
26
|
-
: Space-separated list of application permissions to
|
|
26
|
+
: Space-separated list of application permissions to remove. Specify at least `applicationPermissions` or `delegatedPermissions`.
|
|
27
27
|
|
|
28
28
|
`-d, --delegatedPermissions [delegatedPermissions]`
|
|
29
|
-
: Space-separated list of delegated permissions to
|
|
29
|
+
: Space-separated list of delegated permissions to remove. Specify at least `applicationPermissions` or `delegatedPermissions`.
|
|
30
30
|
|
|
31
31
|
`--revokeAdminConsent`
|
|
32
32
|
: When specified, revokes the admin consent for the specified permissions as well.
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import Global from '/docs/cmd/_global.mdx';
|
|
2
|
+
import Tabs from '@theme/Tabs';
|
|
3
|
+
import TabItem from '@theme/TabItem';
|
|
4
|
+
|
|
5
|
+
# spo site admin list
|
|
6
|
+
|
|
7
|
+
Lists all administrators of a specific SharePoint site
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
m365 spo site admin list [options]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Options
|
|
16
|
+
|
|
17
|
+
```md definition-list
|
|
18
|
+
`-u, --siteUrl <siteUrl>`
|
|
19
|
+
: The URL of the SharePoint site
|
|
20
|
+
|
|
21
|
+
`--asAdmin`
|
|
22
|
+
: List admins as admin for sites you don't have permission to
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
<Global />
|
|
26
|
+
|
|
27
|
+
## Remarks
|
|
28
|
+
|
|
29
|
+
:::info
|
|
30
|
+
|
|
31
|
+
To use this command with the `--asAdmin` mode, you must have permission to access the tenant admin site.
|
|
32
|
+
|
|
33
|
+
Without this parameter, you must have site collection admin permissions for the requested site.
|
|
34
|
+
|
|
35
|
+
In `--asAdmin` mode, the Id, PrincipalType, and PrincipalTypeString properties are not exported.
|
|
36
|
+
|
|
37
|
+
:::
|
|
38
|
+
|
|
39
|
+
## Examples
|
|
40
|
+
|
|
41
|
+
Lists all admins of a SharePoint site
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
m365 spo site admin list --siteUrl https://contoso.sharepoint.com
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Lists all admins of a SharePoint site as admin
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
m365 spo site admin list --siteUrl https://contoso.sharepoint.com --asAdmin
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Response
|
|
54
|
+
|
|
55
|
+
<Tabs>
|
|
56
|
+
<TabItem value="JSON">
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
[
|
|
60
|
+
{
|
|
61
|
+
"Id": 6,
|
|
62
|
+
"LoginName": "i:0#.f|membership|user@contoso.com",
|
|
63
|
+
"Title": "User Example",
|
|
64
|
+
"PrincipalType": 1,
|
|
65
|
+
"PrincipalTypeString": "User",
|
|
66
|
+
"Email": "user@contoso.com",
|
|
67
|
+
"IsPrimaryAdmin": true
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
</TabItem>
|
|
73
|
+
<TabItem value="Text">
|
|
74
|
+
|
|
75
|
+
```text
|
|
76
|
+
Email : user@contoso.com
|
|
77
|
+
Id : 6
|
|
78
|
+
LoginName : i:0#.f|membership|user@contoso.com
|
|
79
|
+
PrincipalType : 1
|
|
80
|
+
PrincipalTypeString : User
|
|
81
|
+
Title : User Example
|
|
82
|
+
IsPrimaryAdmin : true
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
</TabItem>
|
|
86
|
+
<TabItem value="CSV">
|
|
87
|
+
|
|
88
|
+
```csv
|
|
89
|
+
Id,LoginName,Title,PrincipalType,PrincipalTypeString,Email,IsPrimaryAdmin
|
|
90
|
+
6,i:0#.f|membership|user@contoso.com,User Example,1,User,user@contoso.com,1
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
</TabItem>
|
|
94
|
+
<TabItem value="Markdown">
|
|
95
|
+
|
|
96
|
+
```md
|
|
97
|
+
# spo site admin list --siteUrl "https://contoso.sharepoint.com/sites/Test"
|
|
98
|
+
|
|
99
|
+
Date: 20/03/2024
|
|
100
|
+
|
|
101
|
+
## User
|
|
102
|
+
|
|
103
|
+
Property | Value
|
|
104
|
+
---------|-------
|
|
105
|
+
Id | 6
|
|
106
|
+
LoginName | i:0#.f\|membership\|user@contoso.com
|
|
107
|
+
Title | User Example
|
|
108
|
+
PrincipalType | 1
|
|
109
|
+
PrincipalTypeString | User
|
|
110
|
+
Email | user@contoso.com
|
|
111
|
+
IsPrimaryAdmin | true
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
</TabItem>
|
|
115
|
+
</Tabs>
|
|
@@ -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)
|