@pnp/cli-microsoft365 10.11.0 → 11.0.0-beta.3143306
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/.devproxy/api-specs/sharepoint.yaml +54 -0
- package/.eslintrc.cjs +2 -0
- package/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/Command.js +4 -0
- package/dist/config.js +1 -0
- package/dist/m365/adaptivecard/commands/adaptivecard-send.js +1 -1
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-add.js +13 -27
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-get.js +18 -43
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-list.js +10 -21
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-remove.js +25 -49
- package/dist/m365/entra/commands/app/app-add.js +14 -2
- package/dist/m365/entra/commands/group/group-member-add.js +6 -27
- package/dist/m365/entra/commands/group/group-member-set.js +5 -26
- package/dist/m365/entra/commands/m365group/m365group-get.js +1 -7
- package/dist/m365/entra/commands/m365group/m365group-list.js +1 -7
- package/dist/m365/entra/commands/pim/pim-role-assignment-eligibility-list.js +1 -7
- package/dist/m365/entra/commands/pim/pim-role-assignment-list.js +1 -7
- package/dist/m365/entra/commands/pim/pim-role-request-list.js +1 -7
- package/dist/m365/entra/commands/roleassignment/roleassignment-add.js +146 -0
- package/dist/m365/entra/commands.js +1 -0
- package/dist/m365/flow/commands/environment/environment-get.js +19 -29
- package/dist/m365/flow/commands/flow-list.js +7 -14
- package/dist/m365/flow/commands/run/run-get.js +1 -7
- package/dist/m365/graph/commands/openextension/openextension-add.js +2 -2
- package/dist/m365/graph/commands/openextension/openextension-set.js +2 -6
- package/dist/m365/graph/commands/subscription/subscription-add.js +3 -10
- package/dist/m365/outlook/commands/mail/mail-searchfolder-add.js +85 -0
- package/dist/m365/outlook/commands.js +1 -0
- package/dist/m365/pa/commands/environment/environment-get.js +18 -23
- package/dist/m365/pp/commands/copilot/copilot-get.js +0 -4
- package/dist/m365/pp/commands/copilot/copilot-list.js +0 -4
- package/dist/m365/pp/commands/copilot/copilot-remove.js +0 -4
- package/dist/m365/pp/commands/environment/environment-get.js +19 -26
- package/dist/m365/pp/commands/solution/solution-publisher-list.js +1 -8
- package/dist/m365/pp/commands.js +0 -7
- package/dist/m365/purview/commands/threatassessment/threatassessment-get.js +1 -7
- package/dist/m365/spe/commands/container/container-add.js +1 -3
- package/dist/m365/spe/commands/container/container-list.js +1 -3
- package/dist/m365/spe/commands/container/container-recyclebinitem-list.js +1 -3
- package/dist/m365/spe/commands/container/container-recyclebinitem-restore.js +1 -3
- package/dist/m365/spe/commands/container/container-remove.js +1 -3
- package/dist/m365/spe/commands/containertype/containertype-add.js +67 -90
- package/dist/m365/spe/commands/containertype/containertype-get.js +53 -81
- package/dist/m365/spe/commands/containertype/containertype-list.js +8 -19
- package/dist/m365/spe/commands/containertype/containertype-remove.js +27 -5
- package/dist/m365/spfx/commands/project/project-upgrade.js +23 -66
- package/dist/m365/spo/commands/customaction/customaction-list.js +3 -10
- package/dist/m365/spo/commands/file/file-move.js +2 -8
- package/dist/m365/spo/commands/file/file-version-keep.js +78 -0
- package/dist/m365/spo/commands/homesite/homesite-add.js +26 -2
- package/dist/m365/spo/commands/homesite/homesite-get.js +28 -14
- package/dist/m365/spo/commands/homesite/homesite-list.js +1 -12
- package/dist/m365/spo/commands/homesite/homesite-remove.js +6 -34
- package/dist/m365/spo/commands/homesite/homesite-set.js +88 -44
- package/dist/m365/spo/commands/hubsite/hubsite-get.js +4 -13
- package/dist/m365/spo/commands/hubsite/hubsite-list.js +1 -8
- package/dist/m365/spo/commands/list/list-view-add.js +1 -1
- package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-grant-list.js +17 -25
- package/dist/m365/spo/commands/{tenant/tenant-site-archive.js → site/site-archive.js} +14 -14
- package/dist/m365/spo/commands/{tenant/tenant-site-list.js → site/site-list.js} +16 -27
- package/dist/m365/spo/commands/{tenant/tenant-site-membership-list.js → site/site-membership-list.js} +15 -15
- package/dist/m365/spo/commands/{tenant/tenant-site-rename.js → site/site-rename.js} +14 -14
- package/dist/m365/spo/commands/{tenant/tenant-site-unarchive.js → site/site-unarchive.js} +14 -14
- package/dist/m365/spo/commands/term/term-list.js +1 -7
- package/dist/m365/spo/commands.js +5 -7
- package/dist/m365/teams/commands/chat/chat-member-add.js +3 -9
- package/dist/m365/teams/commands/report/report-directroutingcalls.js +5 -12
- package/dist/m365/teams/commands/report/report-pstncalls.js +5 -12
- package/dist/m365/viva/commands/engage/engage-network-list.js +1 -7
- package/dist/m365/viva/commands.js +0 -3
- package/dist/utils/entraAdministrativeUnit.js +1 -1
- package/dist/utils/entraApp.js +15 -0
- package/dist/utils/spe.js +5 -39
- package/docs/docs/cmd/entra/app/app-add.mdx +7 -1
- package/docs/docs/cmd/entra/group/group-member-add.mdx +7 -26
- package/docs/docs/cmd/entra/group/group-member-set.mdx +5 -23
- package/docs/docs/cmd/entra/m365group/m365group-get.mdx +0 -3
- package/docs/docs/cmd/entra/m365group/m365group-list.mdx +0 -3
- package/docs/docs/cmd/entra/pim/pim-role-assignment-eligibility-list.mdx +0 -3
- package/docs/docs/cmd/entra/pim/pim-role-assignment-list.mdx +0 -3
- package/docs/docs/cmd/entra/pim/pim-role-request-list.mdx +0 -3
- package/docs/docs/cmd/entra/roleassignment/roleassignment-add.mdx +163 -0
- package/docs/docs/cmd/flow/environment/environment-get.mdx +6 -5
- package/docs/docs/cmd/flow/flow-list.mdx +0 -3
- package/docs/docs/cmd/flow/run/run-get.mdx +0 -3
- package/docs/docs/cmd/graph/subscription/subscription-add.mdx +0 -3
- package/docs/docs/cmd/outlook/mail/mail-searchfolder-add.mdx +147 -0
- package/docs/docs/cmd/pa/environment/environment-get.mdx +5 -2
- package/docs/docs/cmd/pp/copilot/copilot-get.mdx +0 -6
- package/docs/docs/cmd/pp/copilot/copilot-list.mdx +0 -6
- package/docs/docs/cmd/pp/copilot/copilot-remove.mdx +0 -6
- package/docs/docs/cmd/pp/environment/environment-get.mdx +5 -2
- package/docs/docs/cmd/pp/solution/solution-publisher-list.mdx +0 -3
- package/docs/docs/cmd/purview/threatassessment/threatassessment-get.mdx +0 -3
- package/docs/docs/cmd/spe/container/container-activate.mdx +21 -0
- package/docs/docs/cmd/spe/container/container-add.mdx +29 -0
- package/docs/docs/cmd/spe/container/container-get.mdx +20 -1
- package/docs/docs/cmd/spe/container/container-list.mdx +29 -0
- package/docs/docs/cmd/spe/container/container-permission-list.mdx +19 -0
- package/docs/docs/cmd/spe/container/container-recyclebinitem-list.mdx +29 -0
- package/docs/docs/cmd/spe/container/container-recyclebinitem-restore.mdx +31 -0
- package/docs/docs/cmd/spe/container/container-remove.mdx +31 -0
- package/docs/docs/cmd/spe/containertype/containertype-add.mdx +111 -55
- package/docs/docs/cmd/spe/containertype/containertype-get.mdx +69 -38
- package/docs/docs/cmd/spe/containertype/containertype-list.mdx +59 -31
- package/docs/docs/cmd/spe/containertype/containertype-remove.mdx +31 -4
- package/docs/docs/cmd/spfx/project/project-upgrade.mdx +18 -5
- package/docs/docs/cmd/spo/file/file-move.mdx +0 -3
- package/docs/docs/cmd/spo/file/file-version-keep.mdx +68 -0
- package/docs/docs/cmd/spo/homesite/homesite-add.mdx +13 -4
- package/docs/docs/cmd/spo/homesite/homesite-get.mdx +44 -23
- package/docs/docs/cmd/spo/homesite/homesite-list.mdx +0 -6
- package/docs/docs/cmd/spo/homesite/homesite-remove.mdx +10 -35
- package/docs/docs/cmd/spo/homesite/homesite-set.mdx +84 -44
- package/docs/docs/cmd/spo/hubsite/hubsite-get.mdx +0 -3
- package/docs/docs/cmd/spo/hubsite/hubsite-list.mdx +0 -3
- package/docs/docs/cmd/spo/list/list-view-add.mdx +11 -11
- package/docs/docs/cmd/spo/serviceprincipal/serviceprincipal-grant-list.mdx +18 -18
- package/docs/docs/cmd/spo/{tenant/tenant-site-archive.mdx → site/site-archive.mdx} +4 -4
- package/docs/docs/cmd/spo/{tenant/tenant-site-list.mdx → site/site-list.mdx} +7 -16
- package/docs/docs/cmd/spo/{tenant/tenant-site-membership-list.mdx → site/site-membership-list.mdx} +5 -5
- package/docs/docs/cmd/spo/{tenant/tenant-site-rename.mdx → site/site-rename.mdx} +7 -7
- package/docs/docs/cmd/spo/{tenant/tenant-site-unarchive.mdx → site/site-unarchive.mdx} +4 -4
- package/docs/docs/cmd/spo/term/term-list.mdx +0 -3
- package/docs/docs/cmd/teams/chat/chat-member-add.mdx +2 -5
- package/docs/docs/cmd/teams/report/report-directroutingcalls.mdx +25 -44
- package/docs/docs/cmd/teams/report/report-pstncalls.mdx +25 -48
- package/docs/docs/cmd/viva/engage/engage-community-list.mdx +19 -0
- package/docs/docs/cmd/viva/engage/engage-community-user-add.mdx +19 -0
- package/docs/docs/cmd/viva/engage/engage-community-user-remove.mdx +19 -0
- package/docs/docs/cmd/viva/engage/engage-network-list.mdx +0 -3
- package/npm-shrinkwrap.json +53 -53
- package/package.json +13 -13
- package/dist/m365/pp/commands/card/card-clone.js +0 -101
- package/dist/m365/pp/commands/card/card-get.js +0 -89
- package/dist/m365/pp/commands/card/card-list.js +0 -55
- package/dist/m365/pp/commands/card/card-remove.js +0 -105
- package/dist/m365/skype/commands/report/report-activitycounts.js +0 -15
- package/dist/m365/skype/commands/report/report-activityusercounts.js +0 -15
- package/dist/m365/skype/commands/report/report-activityuserdetail.js +0 -15
- package/dist/m365/skype/commands.js +0 -7
- package/dist/m365/spo/commands/mail/mail-send.js +0 -108
- package/dist/m365/spo/commands/tenant/SPOTenantSitePropertiesEnumerable.js +0 -2
- package/dist/m365/spo/commands/tenant/TenantSiteProperties.js +0 -2
- package/dist/m365/viva/commands/engage/engage-group-list.js +0 -93
- package/dist/m365/viva/commands/engage/engage-group-user-add.js +0 -73
- package/dist/m365/viva/commands/engage/engage-group-user-remove.js +0 -88
- package/docs/docs/cmd/pp/card/card-clone.mdx +0 -103
- package/docs/docs/cmd/pp/card/card-get.mdx +0 -212
- package/docs/docs/cmd/pp/card/card-list.mdx +0 -163
- package/docs/docs/cmd/pp/card/card-remove.mdx +0 -86
- package/docs/docs/cmd/skype/report/report-activitycounts.mdx +0 -96
- package/docs/docs/cmd/skype/report/report-activityusercounts.mdx +0 -96
- package/docs/docs/cmd/skype/report/report-activityuserdetail.mdx +0 -134
- package/docs/docs/cmd/spo/mail/mail-send.mdx +0 -69
- package/docs/docs/cmd/viva/engage/engage-group-list.mdx +0 -174
- package/docs/docs/cmd/viva/engage/engage-group-user-add.mdx +0 -60
- package/docs/docs/cmd/viva/engage/engage-group-user-remove.mdx +0 -58
|
@@ -1,28 +1,42 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { zod } from '../../../../utils/zod.js';
|
|
3
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
4
|
+
import { validation } from '../../../../utils/validation.js';
|
|
2
5
|
import { spo } from '../../../../utils/spo.js';
|
|
3
6
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
4
7
|
import commands from '../../commands.js';
|
|
8
|
+
import { odata } from '../../../../utils/odata.js';
|
|
9
|
+
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
10
|
+
const options = globalOptionsZod
|
|
11
|
+
.extend({
|
|
12
|
+
url: zod.alias('u', z.string()
|
|
13
|
+
.refine(url => validation.isValidSharePointUrl(url) === true, url => ({
|
|
14
|
+
message: `'${url}' is not a valid SharePoint Online site URL.`
|
|
15
|
+
})))
|
|
16
|
+
})
|
|
17
|
+
.strict();
|
|
5
18
|
class SpoHomeSiteGetCommand extends SpoCommand {
|
|
6
19
|
get name() {
|
|
7
20
|
return commands.HOMESITE_GET;
|
|
8
21
|
}
|
|
9
22
|
get description() {
|
|
10
|
-
return 'Gets information about
|
|
23
|
+
return 'Gets information about a home site';
|
|
11
24
|
}
|
|
12
|
-
|
|
25
|
+
get schema() {
|
|
26
|
+
return options;
|
|
27
|
+
}
|
|
28
|
+
async commandAction(logger, args) {
|
|
13
29
|
try {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const res = await request.get(requestOptions);
|
|
23
|
-
if (!res["odata.null"]) {
|
|
24
|
-
await logger.log(res);
|
|
30
|
+
const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.verbose);
|
|
31
|
+
if (this.verbose) {
|
|
32
|
+
await logger.log(`Retrieving home sites...`);
|
|
33
|
+
}
|
|
34
|
+
const homeSites = await odata.getAllItems(`${spoAdminUrl}/_api/SPO.Tenant/GetTargetedSitesDetails`);
|
|
35
|
+
const homeSite = homeSites.find(hs => urlUtil.removeTrailingSlashes(hs.Url).toLowerCase() === urlUtil.removeTrailingSlashes(args.options.url).toLowerCase());
|
|
36
|
+
if (homeSite === undefined) {
|
|
37
|
+
throw `Home site with URL '${args.options.url}' not found.`;
|
|
25
38
|
}
|
|
39
|
+
await logger.log(homeSite);
|
|
26
40
|
}
|
|
27
41
|
catch (err) {
|
|
28
42
|
this.handleRejectedODataJsonPromise(err);
|
|
@@ -9,27 +9,16 @@ class SpoHomeSiteListCommand extends SpoCommand {
|
|
|
9
9
|
get description() {
|
|
10
10
|
return 'Lists all home sites';
|
|
11
11
|
}
|
|
12
|
-
alias() {
|
|
13
|
-
return [commands.TENANT_HOMESITE_LIST];
|
|
14
|
-
}
|
|
15
12
|
defaultProperties() {
|
|
16
13
|
return ['Url', 'Title'];
|
|
17
14
|
}
|
|
18
15
|
async commandAction(logger) {
|
|
19
|
-
await this.showDeprecationWarning(logger, commands.TENANT_HOMESITE_LIST, commands.HOMESITE_LIST);
|
|
20
16
|
try {
|
|
21
17
|
const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.verbose);
|
|
22
|
-
const requestOptions = {
|
|
23
|
-
url: `${spoAdminUrl}/_api/SPO.Tenant/GetTargetedSitesDetails`,
|
|
24
|
-
headers: {
|
|
25
|
-
accept: 'application/json;odata=nometadata'
|
|
26
|
-
},
|
|
27
|
-
responseType: 'json'
|
|
28
|
-
};
|
|
29
18
|
if (this.verbose) {
|
|
30
19
|
await logger.logToStderr(`Retrieving all home sites...`);
|
|
31
20
|
}
|
|
32
|
-
const res = await odata.getAllItems(
|
|
21
|
+
const res = await odata.getAllItems(`${spoAdminUrl}/_api/SPO.Tenant/GetTargetedSitesDetails`);
|
|
33
22
|
await logger.log(res);
|
|
34
23
|
}
|
|
35
24
|
catch (err) {
|
|
@@ -3,7 +3,6 @@ import { zod } from '../../../../utils/zod.js';
|
|
|
3
3
|
import { globalOptionsZod } from '../../../../Command.js';
|
|
4
4
|
import { validation } from '../../../../utils/validation.js';
|
|
5
5
|
import { cli } from '../../../../cli/cli.js';
|
|
6
|
-
import config from '../../../../config.js';
|
|
7
6
|
import request from '../../../../request.js';
|
|
8
7
|
import { spo } from '../../../../utils/spo.js';
|
|
9
8
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
@@ -13,7 +12,7 @@ const options = globalOptionsZod
|
|
|
13
12
|
url: zod.alias('u', z.string()
|
|
14
13
|
.refine(url => validation.isValidSharePointUrl(url) === true, url => ({
|
|
15
14
|
message: `'${url}' is not a valid SharePoint Online site URL.`
|
|
16
|
-
}))
|
|
15
|
+
}))),
|
|
17
16
|
force: zod.alias('f', z.boolean().optional())
|
|
18
17
|
})
|
|
19
18
|
.strict();
|
|
@@ -30,34 +29,8 @@ class SpoHomeSiteRemoveCommand extends SpoCommand {
|
|
|
30
29
|
async commandAction(logger, args) {
|
|
31
30
|
const removeHomeSite = async () => {
|
|
32
31
|
try {
|
|
33
|
-
if (this.verbose) {
|
|
34
|
-
await logger.logToStderr(`Removing ${args.options.url ? `'${args.options.url}' as home site` : 'the current home site'}...`);
|
|
35
|
-
}
|
|
36
32
|
const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
|
|
37
|
-
|
|
38
|
-
if (args.options.url) {
|
|
39
|
-
await this.removeHomeSiteByUrl(args.options.url, spoAdminUrl, logger);
|
|
40
|
-
await logger.log(`${args.options.url} has been removed as a Home Site. It may take some time for the change to apply. Check aka.ms/homesites for details.`);
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
await this.warn(logger, `The current way this command works is deprecated and will change in the next major release. The '--url' option will become required.`);
|
|
44
|
-
const requestOptions = {
|
|
45
|
-
url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
46
|
-
headers: {
|
|
47
|
-
'X-RequestDigest': reqDigest.FormDigestValue
|
|
48
|
-
},
|
|
49
|
-
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="28" ObjectPathId="27" /><Method Name="RemoveSPHSite" Id="29" ObjectPathId="27" /></Actions><ObjectPaths><Constructor Id="27" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /></ObjectPaths></Request>`
|
|
50
|
-
};
|
|
51
|
-
const res = await request.post(requestOptions);
|
|
52
|
-
const json = JSON.parse(res);
|
|
53
|
-
const response = json[0];
|
|
54
|
-
if (response.ErrorInfo) {
|
|
55
|
-
throw response.ErrorInfo.ErrorMessage;
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
await logger.log(json[json.length - 1]);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
33
|
+
await this.removeHomeSiteByUrl(args.options.url, spoAdminUrl, logger);
|
|
61
34
|
}
|
|
62
35
|
catch (err) {
|
|
63
36
|
this.handleRejectedODataJsonPromise(err);
|
|
@@ -67,11 +40,7 @@ class SpoHomeSiteRemoveCommand extends SpoCommand {
|
|
|
67
40
|
await removeHomeSite();
|
|
68
41
|
}
|
|
69
42
|
else {
|
|
70
|
-
const result = await cli.promptForConfirmation({
|
|
71
|
-
message: args.options.url
|
|
72
|
-
? `Are you sure you want to remove '${args.options.url}' as home site?`
|
|
73
|
-
: `Are you sure you want to remove the current home site?`
|
|
74
|
-
});
|
|
43
|
+
const result = await cli.promptForConfirmation({ message: `Are you sure you want to remove '${args.options.url}' as home site?` });
|
|
75
44
|
if (result) {
|
|
76
45
|
await removeHomeSite();
|
|
77
46
|
}
|
|
@@ -79,6 +48,9 @@ class SpoHomeSiteRemoveCommand extends SpoCommand {
|
|
|
79
48
|
}
|
|
80
49
|
async removeHomeSiteByUrl(siteUrl, spoAdminUrl, logger) {
|
|
81
50
|
const siteAdminProperties = await spo.getSiteAdminPropertiesByUrl(siteUrl, false, logger, this.verbose);
|
|
51
|
+
if (this.verbose) {
|
|
52
|
+
await logger.logToStderr(`Removing '${siteUrl}' as home site...`);
|
|
53
|
+
}
|
|
82
54
|
const requestOptions = {
|
|
83
55
|
url: `${spoAdminUrl}/_api/SPO.Tenant/RemoveTargetedSite`,
|
|
84
56
|
headers: {
|
|
@@ -1,79 +1,123 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
-
};
|
|
6
|
-
var _SpoHomeSiteSetCommand_instances, _SpoHomeSiteSetCommand_initTelemetry, _SpoHomeSiteSetCommand_initOptions, _SpoHomeSiteSetCommand_initValidators, _SpoHomeSiteSetCommand_initTypes;
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { zod } from '../../../../utils/zod.js';
|
|
3
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
7
4
|
import request from '../../../../request.js';
|
|
8
5
|
import { spo } from '../../../../utils/spo.js';
|
|
9
6
|
import { validation } from '../../../../utils/validation.js';
|
|
10
7
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
11
8
|
import commands from '../../commands.js';
|
|
9
|
+
import { entraGroup } from '../../../../utils/entraGroup.js';
|
|
10
|
+
const optionsSchema = globalOptionsZod
|
|
11
|
+
.extend({
|
|
12
|
+
url: zod.alias('u', z.string()
|
|
13
|
+
.refine((url) => validation.isValidSharePointUrl(url) === true, url => ({
|
|
14
|
+
message: `'${url}' is not a valid SharePoint Online site URL.`
|
|
15
|
+
}))),
|
|
16
|
+
vivaConnectionsDefaultStart: z.boolean().optional(),
|
|
17
|
+
draftMode: z.boolean().optional(),
|
|
18
|
+
audienceIds: z.string()
|
|
19
|
+
.refine(audiences => validation.isValidGuidArray(audiences) === true, audiences => ({
|
|
20
|
+
message: `The following GUIDs are invalid: ${validation.isValidGuidArray(audiences)}.`
|
|
21
|
+
})).optional(),
|
|
22
|
+
audienceNames: z.string().optional(),
|
|
23
|
+
targetedLicenseType: z.enum(['everyone', 'frontLineWorkers', 'informationWorkers']).optional(),
|
|
24
|
+
order: z.number()
|
|
25
|
+
.refine(order => validation.isValidPositiveInteger(order) === true, order => ({
|
|
26
|
+
message: `'${order}' is not a positive integer.`
|
|
27
|
+
})).optional()
|
|
28
|
+
});
|
|
12
29
|
class SpoHomeSiteSetCommand extends SpoCommand {
|
|
13
30
|
get name() {
|
|
14
31
|
return commands.HOMESITE_SET;
|
|
15
32
|
}
|
|
16
33
|
get description() {
|
|
17
|
-
return '
|
|
34
|
+
return 'Updates an existing SharePoint home site.';
|
|
18
35
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
36
|
+
get schema() {
|
|
37
|
+
return optionsSchema;
|
|
38
|
+
}
|
|
39
|
+
getRefinedSchema(schema) {
|
|
40
|
+
return schema
|
|
41
|
+
.refine((options) => [options.audienceIds, options.audienceNames].filter(o => o !== undefined).length <= 1, {
|
|
42
|
+
message: 'You must specify either audienceIds or audienceNames but not both.'
|
|
43
|
+
})
|
|
44
|
+
.refine((options) => options.vivaConnectionsDefaultStart !== undefined ||
|
|
45
|
+
options.draftMode !== undefined ||
|
|
46
|
+
options.audienceIds !== undefined ||
|
|
47
|
+
options.audienceNames !== undefined ||
|
|
48
|
+
options.targetedLicenseType !== undefined ||
|
|
49
|
+
options.order !== undefined, {
|
|
50
|
+
message: 'You must specify at least one option to configure.'
|
|
51
|
+
});
|
|
26
52
|
}
|
|
27
53
|
async commandAction(logger, args) {
|
|
28
54
|
try {
|
|
29
55
|
if (this.verbose) {
|
|
30
|
-
await logger.logToStderr(`
|
|
31
|
-
await logger.logToStderr(
|
|
56
|
+
await logger.logToStderr(`Configuring SharePoint home site: ${args.options.url}...`);
|
|
57
|
+
await logger.logToStderr(`Attempting to retrieve the SharePoint admin URL.`);
|
|
32
58
|
}
|
|
33
59
|
const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
|
|
60
|
+
const configuration = {};
|
|
61
|
+
if (args.options.vivaConnectionsDefaultStart !== undefined) {
|
|
62
|
+
configuration.IsVivaConnectionsDefaultStartPresent = true;
|
|
63
|
+
configuration.vivaConnectionsDefaultStart = args.options.vivaConnectionsDefaultStart;
|
|
64
|
+
}
|
|
65
|
+
if (args.options.draftMode !== undefined) {
|
|
66
|
+
configuration.IsInDraftModePresent = true;
|
|
67
|
+
configuration.isInDraftMode = args.options.draftMode;
|
|
68
|
+
}
|
|
69
|
+
if (args.options.audienceIds !== undefined) {
|
|
70
|
+
configuration.IsAudiencesPresent = true;
|
|
71
|
+
configuration.Audiences = args.options.audienceIds.split(',').map(id => id.trim());
|
|
72
|
+
}
|
|
73
|
+
if (args.options.audienceNames !== undefined) {
|
|
74
|
+
configuration.IsAudiencesPresent = true;
|
|
75
|
+
configuration.Audiences = args.options.audienceNames.trim() === '' ? [] : await this.transformAudienceNamesToIds(args.options.audienceNames);
|
|
76
|
+
}
|
|
77
|
+
if (args.options.targetedLicenseType !== undefined) {
|
|
78
|
+
configuration.IsTargetedLicenseTypePresent = true;
|
|
79
|
+
configuration.TargetedLicenseType = this.convertTargetedLicenseTypeToNumber(args.options.targetedLicenseType);
|
|
80
|
+
}
|
|
81
|
+
if (args.options.order !== undefined) {
|
|
82
|
+
configuration.IsOrderPresent = true;
|
|
83
|
+
configuration.Order = args.options.order;
|
|
84
|
+
}
|
|
34
85
|
const requestOptions = {
|
|
35
|
-
url: `${spoAdminUrl}/_api/SPO.Tenant`,
|
|
86
|
+
url: `${spoAdminUrl}/_api/SPO.Tenant/UpdateTargetedSite`,
|
|
36
87
|
headers: {
|
|
37
88
|
accept: 'application/json;odata=nometadata',
|
|
38
89
|
'content-Type': 'application/json'
|
|
39
90
|
},
|
|
40
91
|
responseType: 'json',
|
|
41
92
|
data: {
|
|
42
|
-
|
|
93
|
+
siteUrl: args.options.url,
|
|
94
|
+
configurationParam: configuration
|
|
43
95
|
}
|
|
44
96
|
};
|
|
45
|
-
if (args.options.vivaConnectionsDefaultStart !== undefined) {
|
|
46
|
-
requestOptions.url += '/SetSPHSiteWithConfiguration';
|
|
47
|
-
requestOptions.data.configuration = { vivaConnectionsDefaultStart: args.options.vivaConnectionsDefaultStart };
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
requestOptions.url += '/SetSPHSite';
|
|
51
|
-
}
|
|
52
97
|
const res = await request.post(requestOptions);
|
|
53
|
-
await logger.log(res
|
|
98
|
+
await logger.log(res);
|
|
54
99
|
}
|
|
55
100
|
catch (err) {
|
|
56
101
|
this.handleRejectedODataJsonPromise(err);
|
|
57
102
|
}
|
|
58
103
|
}
|
|
104
|
+
convertTargetedLicenseTypeToNumber(licenseType) {
|
|
105
|
+
const licenseTypeMap = {
|
|
106
|
+
'everyone': 0,
|
|
107
|
+
'frontLineWorkers': 1,
|
|
108
|
+
'informationWorkers': 2
|
|
109
|
+
};
|
|
110
|
+
return licenseTypeMap[licenseType];
|
|
111
|
+
}
|
|
112
|
+
async transformAudienceNamesToIds(audienceNames) {
|
|
113
|
+
const names = audienceNames.split(',');
|
|
114
|
+
const ids = [];
|
|
115
|
+
for (const name of names) {
|
|
116
|
+
const id = await entraGroup.getGroupIdByDisplayName(name.trim());
|
|
117
|
+
ids.push(id);
|
|
118
|
+
}
|
|
119
|
+
return ids;
|
|
120
|
+
}
|
|
59
121
|
}
|
|
60
|
-
_SpoHomeSiteSetCommand_instances = new WeakSet(), _SpoHomeSiteSetCommand_initTelemetry = function _SpoHomeSiteSetCommand_initTelemetry() {
|
|
61
|
-
this.telemetry.push((args) => {
|
|
62
|
-
Object.assign(this.telemetryProperties, {
|
|
63
|
-
vivaConnectionsDefaultStart: typeof args.options.vivaConnectionsDefaultStart !== 'undefined'
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
}, _SpoHomeSiteSetCommand_initOptions = function _SpoHomeSiteSetCommand_initOptions() {
|
|
67
|
-
this.options.unshift({
|
|
68
|
-
option: '-u, --siteUrl <siteUrl>'
|
|
69
|
-
}, {
|
|
70
|
-
option: '--vivaConnectionsDefaultStart [vivaConnectionsDefaultStart]',
|
|
71
|
-
autocomplete: ['true', 'false']
|
|
72
|
-
});
|
|
73
|
-
}, _SpoHomeSiteSetCommand_initValidators = function _SpoHomeSiteSetCommand_initValidators() {
|
|
74
|
-
this.validators.push(async (args) => validation.isValidSharePointUrl(args.options.siteUrl));
|
|
75
|
-
}, _SpoHomeSiteSetCommand_initTypes = function _SpoHomeSiteSetCommand_initTypes() {
|
|
76
|
-
this.types.boolean.push('vivaConnectionsDefaultStart');
|
|
77
|
-
};
|
|
78
122
|
export default new SpoHomeSiteSetCommand();
|
|
79
123
|
//# sourceMappingURL=homesite-set.js.map
|
|
@@ -29,20 +29,12 @@ class SpoHubSiteGetCommand extends SpoCommand {
|
|
|
29
29
|
}
|
|
30
30
|
async commandAction(logger, args) {
|
|
31
31
|
try {
|
|
32
|
-
if (args.options.includeAssociatedSites) {
|
|
33
|
-
await this.warn(logger, `Parameter 'includeAssociatedSites' is deprecated. Please use 'withAssociatedSites' instead`);
|
|
34
|
-
}
|
|
35
32
|
const spoUrl = await spo.getSpoUrl(logger, this.debug);
|
|
36
33
|
const hubSite = args.options.id ? await this.getHubSiteById(spoUrl, args.options) : await this.getHubSite(spoUrl, args.options);
|
|
37
|
-
if (
|
|
38
|
-
|
|
39
|
-
throw 'includeAssociatedSites option is only allowed with json output mode';
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
throw 'withAssociatedSites option is only allowed with json output mode';
|
|
43
|
-
}
|
|
34
|
+
if (args.options.withAssociatedSites && (args.options.output && args.options.output !== 'json')) {
|
|
35
|
+
throw 'withAssociatedSites option is only allowed with json output mode';
|
|
44
36
|
}
|
|
45
|
-
if (
|
|
37
|
+
if (args.options.withAssociatedSites === true && args.options.output && !cli.shouldTrimOutput(args.options.output)) {
|
|
46
38
|
const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
|
|
47
39
|
const associatedSitesCommandOutput = await this.getAssociatedSites(spoAdminUrl, hubSite.SiteId, logger, args);
|
|
48
40
|
const associatedSites = JSON.parse(associatedSitesCommandOutput.stdout);
|
|
@@ -108,12 +100,11 @@ _SpoHubSiteGetCommand_instances = new WeakSet(), _SpoHubSiteGetCommand_initTelem
|
|
|
108
100
|
id: typeof args.options.id !== 'undefined',
|
|
109
101
|
title: typeof args.options.title !== 'undefined',
|
|
110
102
|
url: typeof args.options.url !== 'undefined',
|
|
111
|
-
includeAssociatedSites: args.options.includeAssociatedSites === true,
|
|
112
103
|
withAssociatedSites: args.options.withAssociatedSites === true
|
|
113
104
|
});
|
|
114
105
|
});
|
|
115
106
|
}, _SpoHubSiteGetCommand_initOptions = function _SpoHubSiteGetCommand_initOptions() {
|
|
116
|
-
this.options.unshift({ option: '-i, --id [id]' }, { option: '-t, --title [title]' }, { option: '-u, --url [url]' }, { option: '--
|
|
107
|
+
this.options.unshift({ option: '-i, --id [id]' }, { option: '-t, --title [title]' }, { option: '-u, --url [url]' }, { option: '--withAssociatedSites' });
|
|
117
108
|
}, _SpoHubSiteGetCommand_initValidators = function _SpoHubSiteGetCommand_initValidators() {
|
|
118
109
|
this.validators.push(async (args) => {
|
|
119
110
|
if (args.options.id && !validation.isValidGuid(args.options.id)) {
|
|
@@ -29,14 +29,10 @@ class SpoHubSiteListCommand extends SpoCommand {
|
|
|
29
29
|
}
|
|
30
30
|
async commandAction(logger, args) {
|
|
31
31
|
try {
|
|
32
|
-
if (args.options.includeAssociatedSites) {
|
|
33
|
-
await this.warn(logger, `Parameter 'includeAssociatedSites' is deprecated. Please use 'withAssociatedSites' instead`);
|
|
34
|
-
}
|
|
35
32
|
const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
|
|
36
33
|
const hubSitesResult = await odata.getAllItems(`${spoAdminUrl}/_api/hubsites`);
|
|
37
34
|
const hubSites = hubSitesResult;
|
|
38
|
-
|
|
39
|
-
if (!(shouldIncludeAssociatedSites !== true || args.options.output && args.options.output !== 'json')) {
|
|
35
|
+
if (!(args.options.withAssociatedSites !== true || args.options.output && args.options.output !== 'json')) {
|
|
40
36
|
if (this.debug) {
|
|
41
37
|
await logger.logToStderr('Retrieving associated sites...');
|
|
42
38
|
await logger.logToStderr('');
|
|
@@ -108,14 +104,11 @@ class SpoHubSiteListCommand extends SpoCommand {
|
|
|
108
104
|
_SpoHubSiteListCommand_instances = new WeakSet(), _SpoHubSiteListCommand_initTelemetry = function _SpoHubSiteListCommand_initTelemetry() {
|
|
109
105
|
this.telemetry.push((args) => {
|
|
110
106
|
Object.assign(this.telemetryProperties, {
|
|
111
|
-
includeAssociatedSites: args.options.includeAssociatedSites === true,
|
|
112
107
|
withAssociatedSites: args.options.withAssociatedSites === true
|
|
113
108
|
});
|
|
114
109
|
});
|
|
115
110
|
}, _SpoHubSiteListCommand_initOptions = function _SpoHubSiteListCommand_initOptions() {
|
|
116
111
|
this.options.unshift({
|
|
117
|
-
option: '-i, --includeAssociatedSites'
|
|
118
|
-
}, {
|
|
119
112
|
option: '--withAssociatedSites'
|
|
120
113
|
});
|
|
121
114
|
};
|
|
@@ -114,7 +114,7 @@ class SpoListViewAddCommand extends SpoCommand {
|
|
|
114
114
|
Query: args.options.viewQuery,
|
|
115
115
|
PersonalView: !!args.options.personal,
|
|
116
116
|
SetAsDefaultView: !!args.options.default,
|
|
117
|
-
Paged:
|
|
117
|
+
Paged: args.options.paged ?? true,
|
|
118
118
|
RowLimit: args.options.rowLimit ?? 30,
|
|
119
119
|
CustomFormatter: args.options.customFormatter
|
|
120
120
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import config from '../../../../config.js';
|
|
2
1
|
import request from '../../../../request.js';
|
|
3
|
-
import
|
|
4
|
-
import SpoCommand from '../../../base/SpoCommand.js';
|
|
2
|
+
import GraphCommand from '../../../base/GraphCommand.js';
|
|
5
3
|
import commands from '../../commands.js';
|
|
6
|
-
class SpoServicePrincipalGrantListCommand extends
|
|
4
|
+
class SpoServicePrincipalGrantListCommand extends GraphCommand {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.spoServicePrincipalDisplayName = 'SharePoint Online Web Client Extensibility';
|
|
8
|
+
}
|
|
7
9
|
get name() {
|
|
8
10
|
return commands.SERVICEPRINCIPAL_GRANT_LIST;
|
|
9
11
|
}
|
|
@@ -15,36 +17,26 @@ class SpoServicePrincipalGrantListCommand extends SpoCommand {
|
|
|
15
17
|
}
|
|
16
18
|
async commandAction(logger) {
|
|
17
19
|
try {
|
|
18
|
-
const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
|
|
19
20
|
if (this.verbose) {
|
|
20
|
-
await logger.logToStderr(`Retrieving
|
|
21
|
+
await logger.logToStderr(`Retrieving permissions granted to the service principal '${this.spoServicePrincipalDisplayName}'...`);
|
|
21
22
|
}
|
|
22
|
-
const reqDigest = await spo.getRequestDigest(spoAdminUrl);
|
|
23
23
|
const requestOptions = {
|
|
24
|
-
url: `${
|
|
24
|
+
url: `${this.resource}/v1.0/servicePrincipals?$filter=displayName eq '${this.spoServicePrincipalDisplayName}'&$select=id`,
|
|
25
25
|
headers: {
|
|
26
|
-
|
|
26
|
+
accept: 'application/json;odata.metadata=none'
|
|
27
27
|
},
|
|
28
|
-
|
|
28
|
+
responseType: 'json'
|
|
29
29
|
};
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (response.ErrorInfo) {
|
|
34
|
-
throw response.ErrorInfo.ErrorMessage;
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
const result = json[json.length - 1]._Child_Items_;
|
|
38
|
-
await logger.log(result.map(r => {
|
|
39
|
-
delete r._ObjectType_;
|
|
40
|
-
delete r.ClientId;
|
|
41
|
-
delete r.ConsentType;
|
|
42
|
-
return r;
|
|
43
|
-
}));
|
|
30
|
+
const response = await request.get(requestOptions);
|
|
31
|
+
if (response.value.length === 0) {
|
|
32
|
+
throw `Service principal '${this.spoServicePrincipalDisplayName}' not found`;
|
|
44
33
|
}
|
|
34
|
+
requestOptions.url = `${this.resource}/v1.0/servicePrincipals/${response.value[0].id}/oauth2PermissionGrants`;
|
|
35
|
+
const result = await request.get(requestOptions);
|
|
36
|
+
await logger.log(result.value);
|
|
45
37
|
}
|
|
46
38
|
catch (err) {
|
|
47
|
-
this.
|
|
39
|
+
this.handleRejectedODataJsonPromise(err);
|
|
48
40
|
}
|
|
49
41
|
}
|
|
50
42
|
}
|
|
@@ -3,7 +3,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
3
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
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
|
-
var
|
|
6
|
+
var _SpoSiteArchiveCommand_instances, _SpoSiteArchiveCommand_initTelemetry, _SpoSiteArchiveCommand_initOptions, _SpoSiteArchiveCommand_initValidators, _SpoSiteArchiveCommand_initTypes;
|
|
7
7
|
import { cli } from '../../../../cli/cli.js';
|
|
8
8
|
import config from '../../../../config.js';
|
|
9
9
|
import request from '../../../../request.js';
|
|
@@ -11,20 +11,20 @@ import { validation } from '../../../../utils/validation.js';
|
|
|
11
11
|
import { spo } from '../../../../utils/spo.js';
|
|
12
12
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
13
13
|
import commands from '../../commands.js';
|
|
14
|
-
class
|
|
14
|
+
class SpoSiteArchiveCommand extends SpoCommand {
|
|
15
15
|
get name() {
|
|
16
|
-
return commands.
|
|
16
|
+
return commands.SITE_ARCHIVE;
|
|
17
17
|
}
|
|
18
18
|
get description() {
|
|
19
19
|
return 'Archives a site collection';
|
|
20
20
|
}
|
|
21
21
|
constructor() {
|
|
22
22
|
super();
|
|
23
|
-
|
|
24
|
-
__classPrivateFieldGet(this,
|
|
25
|
-
__classPrivateFieldGet(this,
|
|
26
|
-
__classPrivateFieldGet(this,
|
|
27
|
-
__classPrivateFieldGet(this,
|
|
23
|
+
_SpoSiteArchiveCommand_instances.add(this);
|
|
24
|
+
__classPrivateFieldGet(this, _SpoSiteArchiveCommand_instances, "m", _SpoSiteArchiveCommand_initTelemetry).call(this);
|
|
25
|
+
__classPrivateFieldGet(this, _SpoSiteArchiveCommand_instances, "m", _SpoSiteArchiveCommand_initOptions).call(this);
|
|
26
|
+
__classPrivateFieldGet(this, _SpoSiteArchiveCommand_instances, "m", _SpoSiteArchiveCommand_initValidators).call(this);
|
|
27
|
+
__classPrivateFieldGet(this, _SpoSiteArchiveCommand_instances, "m", _SpoSiteArchiveCommand_initTypes).call(this);
|
|
28
28
|
}
|
|
29
29
|
async commandAction(logger, args) {
|
|
30
30
|
const archiveSite = async () => {
|
|
@@ -81,19 +81,19 @@ class SpoTenantSiteArchiveCommand extends SpoCommand {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
|
|
84
|
+
_SpoSiteArchiveCommand_instances = new WeakSet(), _SpoSiteArchiveCommand_initTelemetry = function _SpoSiteArchiveCommand_initTelemetry() {
|
|
85
85
|
this.telemetry.push((args) => {
|
|
86
86
|
Object.assign(this.telemetryProperties, {
|
|
87
87
|
force: !!args.options.force
|
|
88
88
|
});
|
|
89
89
|
});
|
|
90
|
-
},
|
|
90
|
+
}, _SpoSiteArchiveCommand_initOptions = function _SpoSiteArchiveCommand_initOptions() {
|
|
91
91
|
this.options.unshift({ option: '-u, --url <url>' }, { option: '-f, --force' });
|
|
92
|
-
},
|
|
92
|
+
}, _SpoSiteArchiveCommand_initValidators = function _SpoSiteArchiveCommand_initValidators() {
|
|
93
93
|
this.validators.push(async (args) => validation.isValidSharePointUrl(args.options.url));
|
|
94
|
-
},
|
|
94
|
+
}, _SpoSiteArchiveCommand_initTypes = function _SpoSiteArchiveCommand_initTypes() {
|
|
95
95
|
this.types.string.push('url');
|
|
96
96
|
this.types.boolean.push('force');
|
|
97
97
|
};
|
|
98
|
-
export default new
|
|
99
|
-
//# sourceMappingURL=
|
|
98
|
+
export default new SpoSiteArchiveCommand();
|
|
99
|
+
//# sourceMappingURL=site-archive.js.map
|