@pnp/cli-microsoft365 10.11.0 → 11.0.0-beta.3655c37

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.
Files changed (86) hide show
  1. package/.devproxy/api-specs/sharepoint.yaml +54 -0
  2. package/.eslintrc.cjs +2 -0
  3. package/allCommands.json +1 -1
  4. package/allCommandsFull.json +1 -1
  5. package/dist/Command.js +4 -0
  6. package/dist/m365/adaptivecard/commands/adaptivecard-send.js +1 -1
  7. package/dist/m365/entra/commands/administrativeunit/administrativeunit-add.js +13 -27
  8. package/dist/m365/entra/commands/administrativeunit/administrativeunit-get.js +18 -43
  9. package/dist/m365/entra/commands/administrativeunit/administrativeunit-list.js +10 -21
  10. package/dist/m365/entra/commands/administrativeunit/administrativeunit-remove.js +25 -49
  11. package/dist/m365/entra/commands/app/app-add.js +14 -2
  12. package/dist/m365/entra/commands/roleassignment/roleassignment-add.js +146 -0
  13. package/dist/m365/entra/commands.js +1 -0
  14. package/dist/m365/flow/commands/environment/environment-get.js +19 -29
  15. package/dist/m365/graph/commands/openextension/openextension-add.js +2 -2
  16. package/dist/m365/graph/commands/openextension/openextension-set.js +2 -6
  17. package/dist/m365/outlook/commands/mail/mail-searchfolder-add.js +85 -0
  18. package/dist/m365/outlook/commands.js +1 -0
  19. package/dist/m365/pa/commands/environment/environment-get.js +18 -23
  20. package/dist/m365/pp/commands/copilot/copilot-get.js +0 -4
  21. package/dist/m365/pp/commands/copilot/copilot-list.js +0 -4
  22. package/dist/m365/pp/commands/copilot/copilot-remove.js +0 -4
  23. package/dist/m365/pp/commands/environment/environment-get.js +19 -26
  24. package/dist/m365/pp/commands.js +0 -7
  25. package/dist/m365/spfx/commands/project/project-upgrade.js +23 -66
  26. package/dist/m365/spo/commands/customaction/customaction-list.js +3 -10
  27. package/dist/m365/spo/commands/file/file-version-keep.js +78 -0
  28. package/dist/m365/spo/commands/homesite/homesite-get.js +28 -14
  29. package/dist/m365/spo/commands/homesite/homesite-list.js +1 -12
  30. package/dist/m365/spo/commands/homesite/homesite-remove.js +6 -34
  31. package/dist/m365/spo/commands/homesite/homesite-set.js +88 -44
  32. package/dist/m365/spo/commands/list/list-view-add.js +1 -1
  33. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-grant-list.js +17 -25
  34. package/dist/m365/spo/commands.js +1 -2
  35. package/dist/m365/teams/commands/report/report-directroutingcalls.js +5 -12
  36. package/dist/m365/teams/commands/report/report-pstncalls.js +5 -12
  37. package/dist/m365/viva/commands.js +0 -3
  38. package/dist/utils/entraAdministrativeUnit.js +1 -1
  39. package/dist/utils/entraApp.js +15 -0
  40. package/docs/docs/cmd/entra/app/app-add.mdx +7 -1
  41. package/docs/docs/cmd/entra/roleassignment/roleassignment-add.mdx +163 -0
  42. package/docs/docs/cmd/flow/environment/environment-get.mdx +6 -5
  43. package/docs/docs/cmd/outlook/mail/mail-searchfolder-add.mdx +147 -0
  44. package/docs/docs/cmd/pa/environment/environment-get.mdx +5 -2
  45. package/docs/docs/cmd/pp/copilot/copilot-get.mdx +0 -6
  46. package/docs/docs/cmd/pp/copilot/copilot-list.mdx +0 -6
  47. package/docs/docs/cmd/pp/copilot/copilot-remove.mdx +0 -6
  48. package/docs/docs/cmd/pp/environment/environment-get.mdx +5 -2
  49. package/docs/docs/cmd/spfx/project/project-upgrade.mdx +18 -5
  50. package/docs/docs/cmd/spo/file/file-version-keep.mdx +68 -0
  51. package/docs/docs/cmd/spo/homesite/homesite-get.mdx +44 -23
  52. package/docs/docs/cmd/spo/homesite/homesite-list.mdx +0 -6
  53. package/docs/docs/cmd/spo/homesite/homesite-remove.mdx +10 -35
  54. package/docs/docs/cmd/spo/homesite/homesite-set.mdx +85 -45
  55. package/docs/docs/cmd/spo/list/list-view-add.mdx +11 -11
  56. package/docs/docs/cmd/spo/serviceprincipal/serviceprincipal-grant-list.mdx +18 -18
  57. package/docs/docs/cmd/teams/report/report-directroutingcalls.mdx +25 -44
  58. package/docs/docs/cmd/teams/report/report-pstncalls.mdx +25 -48
  59. package/docs/docs/cmd/viva/engage/engage-community-list.mdx +19 -0
  60. package/docs/docs/cmd/viva/engage/engage-community-user-add.mdx +19 -0
  61. package/docs/docs/cmd/viva/engage/engage-community-user-remove.mdx +19 -0
  62. package/npm-shrinkwrap.json +53 -53
  63. package/package.json +13 -13
  64. package/dist/m365/pp/commands/card/card-clone.js +0 -101
  65. package/dist/m365/pp/commands/card/card-get.js +0 -89
  66. package/dist/m365/pp/commands/card/card-list.js +0 -55
  67. package/dist/m365/pp/commands/card/card-remove.js +0 -105
  68. package/dist/m365/skype/commands/report/report-activitycounts.js +0 -15
  69. package/dist/m365/skype/commands/report/report-activityusercounts.js +0 -15
  70. package/dist/m365/skype/commands/report/report-activityuserdetail.js +0 -15
  71. package/dist/m365/skype/commands.js +0 -7
  72. package/dist/m365/spo/commands/mail/mail-send.js +0 -108
  73. package/dist/m365/viva/commands/engage/engage-group-list.js +0 -93
  74. package/dist/m365/viva/commands/engage/engage-group-user-add.js +0 -73
  75. package/dist/m365/viva/commands/engage/engage-group-user-remove.js +0 -88
  76. package/docs/docs/cmd/pp/card/card-clone.mdx +0 -103
  77. package/docs/docs/cmd/pp/card/card-get.mdx +0 -212
  78. package/docs/docs/cmd/pp/card/card-list.mdx +0 -163
  79. package/docs/docs/cmd/pp/card/card-remove.mdx +0 -86
  80. package/docs/docs/cmd/skype/report/report-activitycounts.mdx +0 -96
  81. package/docs/docs/cmd/skype/report/report-activityusercounts.mdx +0 -96
  82. package/docs/docs/cmd/skype/report/report-activityuserdetail.mdx +0 -134
  83. package/docs/docs/cmd/spo/mail/mail-send.mdx +0 -69
  84. package/docs/docs/cmd/viva/engage/engage-group-list.mdx +0 -174
  85. package/docs/docs/cmd/viva/engage/engage-group-user-add.mdx +0 -60
  86. package/docs/docs/cmd/viva/engage/engage-group-user-remove.mdx +0 -58
@@ -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
- })).optional()),
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
- const reqDigest = await spo.getRequestDigest(spoAdminUrl);
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
- 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 _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 'Sets the specified site as the Home Site';
34
+ return 'Updates an existing SharePoint home site.';
18
35
  }
19
- constructor() {
20
- super();
21
- _SpoHomeSiteSetCommand_instances.add(this);
22
- __classPrivateFieldGet(this, _SpoHomeSiteSetCommand_instances, "m", _SpoHomeSiteSetCommand_initTelemetry).call(this);
23
- __classPrivateFieldGet(this, _SpoHomeSiteSetCommand_instances, "m", _SpoHomeSiteSetCommand_initOptions).call(this);
24
- __classPrivateFieldGet(this, _SpoHomeSiteSetCommand_instances, "m", _SpoHomeSiteSetCommand_initValidators).call(this);
25
- __classPrivateFieldGet(this, _SpoHomeSiteSetCommand_instances, "m", _SpoHomeSiteSetCommand_initTypes).call(this);
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(`Setting the SharePoint home site to: ${args.options.siteUrl}...`);
31
- await logger.logToStderr('Attempting to retrieve the SharePoint admin URL.');
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
- sphSiteUrl: args.options.siteUrl
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.value);
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
@@ -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: !!args.options.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 { spo } from '../../../../utils/spo.js';
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 SpoCommand {
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 request digest...`);
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: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
24
+ url: `${this.resource}/v1.0/servicePrincipals?$filter=displayName eq '${this.spoServicePrincipalDisplayName}'&$select=id`,
25
25
  headers: {
26
- 'X-RequestDigest': reqDigest.FormDigestValue
26
+ accept: 'application/json;odata.metadata=none'
27
27
  },
28
- 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="4" ObjectPathId="3" /><ObjectPath Id="6" ObjectPathId="5" /><Query Id="7" ObjectPathId="5"><Query SelectAllProperties="true"><Properties /></Query><ChildItemQuery SelectAllProperties="true"><Properties /></ChildItemQuery></Query></Actions><ObjectPaths><Constructor Id="3" TypeId="{104e8f06-1e00-4675-99c6-1b9b504ed8d8}" /><Property Id="5" ParentId="3" Name="PermissionGrants" /></ObjectPaths></Request>`
28
+ responseType: 'json'
29
29
  };
30
- const res = await request.post(requestOptions);
31
- const json = JSON.parse(res);
32
- const response = json[0];
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.handleRejectedPromise(err);
39
+ this.handleRejectedODataJsonPromise(err);
48
40
  }
49
41
  }
50
42
  }
@@ -83,6 +83,7 @@ export default {
83
83
  FILE_SHARINGLINK_SET: `${prefix} file sharinglink set`,
84
84
  FILE_VERSION_CLEAR: `${prefix} file version clear`,
85
85
  FILE_VERSION_GET: `${prefix} file version get`,
86
+ FILE_VERSION_KEEP: `${prefix} file version keep`,
86
87
  FILE_VERSION_LIST: `${prefix} file version list`,
87
88
  FILE_VERSION_REMOVE: `${prefix} file version remove`,
88
89
  FILE_VERSION_RESTORE: `${prefix} file version restore`,
@@ -193,7 +194,6 @@ export default {
193
194
  LISTITEM_ROLEINHERITANCE_BREAK: `${prefix} listitem roleinheritance break`,
194
195
  LISTITEM_ROLEINHERITANCE_RESET: `${prefix} listitem roleinheritance reset`,
195
196
  LISTITEM_SET: `${prefix} listitem set`,
196
- MAIL_SEND: `${prefix} mail send`,
197
197
  NAVIGATION_NODE_ADD: `${prefix} navigation node add`,
198
198
  NAVIGATION_NODE_GET: `${prefix} navigation node get`,
199
199
  NAVIGATION_NODE_LIST: `${prefix} navigation node list`,
@@ -325,7 +325,6 @@ export default {
325
325
  TENANT_COMMANDSET_LIST: `${prefix} tenant commandset list`,
326
326
  TENANT_COMMANDSET_REMOVE: `${prefix} tenant commandset remove`,
327
327
  TENANT_COMMANDSET_SET: `${prefix} tenant commandset set`,
328
- TENANT_HOMESITE_LIST: `${prefix} tenant homesite list`,
329
328
  TENANT_RECYCLEBINITEM_LIST: `${prefix} tenant recyclebinitem list`,
330
329
  TENANT_RECYCLEBINITEM_REMOVE: `${prefix} tenant recyclebinitem remove`,
331
330
  TENANT_RECYCLEBINITEM_RESTORE: `${prefix} tenant recyclebinitem restore`,
@@ -4,12 +4,12 @@ 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 _TeamsReportDirectroutingcallsCommand_instances, _TeamsReportDirectroutingcallsCommand_initTelemetry, _TeamsReportDirectroutingcallsCommand_initOptions, _TeamsReportDirectroutingcallsCommand_initValidators;
7
- import request from '../../../../request.js';
8
7
  import { formatting } from '../../../../utils/formatting.js';
8
+ import { odata } from '../../../../utils/odata.js';
9
9
  import { validation } from '../../../../utils/validation.js';
10
- import GraphCommand from '../../../base/GraphCommand.js';
10
+ import GraphApplicationCommand from '../../../base/GraphCommand.js';
11
11
  import commands from '../../commands.js';
12
- class TeamsReportDirectroutingcallsCommand extends GraphCommand {
12
+ class TeamsReportDirectroutingcallsCommand extends GraphApplicationCommand {
13
13
  get allowedOutputs() {
14
14
  return ['json', 'csv'];
15
15
  }
@@ -31,16 +31,9 @@ class TeamsReportDirectroutingcallsCommand extends GraphCommand {
31
31
  }
32
32
  async commandAction(logger, args) {
33
33
  const toDateTimeParameter = formatting.encodeQueryParameter(args.options.toDateTime ? args.options.toDateTime : new Date().toISOString());
34
- const requestOptions = {
35
- url: `${this.resource}/v1.0/communications/callRecords/getDirectRoutingCalls(fromDateTime=${formatting.encodeQueryParameter(args.options.fromDateTime)},toDateTime=${toDateTimeParameter})`,
36
- headers: {
37
- accept: 'application/json;odata.metadata=none'
38
- },
39
- responseType: 'json'
40
- };
41
34
  try {
42
- const res = await request.get(requestOptions);
43
- await logger.log(res);
35
+ const response = await odata.getAllItems(`${this.resource}/v1.0/communications/callRecords/getDirectRoutingCalls(fromDateTime=${formatting.encodeQueryParameter(args.options.fromDateTime)},toDateTime=${toDateTimeParameter})`);
36
+ await logger.log(response);
44
37
  }
45
38
  catch (err) {
46
39
  this.handleRejectedODataJsonPromise(err);
@@ -4,12 +4,12 @@ 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 _TeamsReportPstncallsCommand_instances, _TeamsReportPstncallsCommand_initTelemetry, _TeamsReportPstncallsCommand_initOptions, _TeamsReportPstncallsCommand_initValidators;
7
- import request from '../../../../request.js';
8
7
  import { formatting } from '../../../../utils/formatting.js';
8
+ import { odata } from '../../../../utils/odata.js';
9
9
  import { validation } from '../../../../utils/validation.js';
10
- import GraphCommand from '../../../base/GraphCommand.js';
10
+ import GraphApplicationCommand from '../../../base/GraphCommand.js';
11
11
  import commands from '../../commands.js';
12
- class TeamsReportPstncallsCommand extends GraphCommand {
12
+ class TeamsReportPstncallsCommand extends GraphApplicationCommand {
13
13
  get allowedOutputs() {
14
14
  return ['json', 'csv'];
15
15
  }
@@ -31,16 +31,9 @@ class TeamsReportPstncallsCommand extends GraphCommand {
31
31
  }
32
32
  async commandAction(logger, args) {
33
33
  const toDateTimeParameter = formatting.encodeQueryParameter(args.options.toDateTime ? args.options.toDateTime : new Date().toISOString());
34
- const requestOptions = {
35
- url: `${this.resource}/v1.0/communications/callRecords/getPstnCalls(fromDateTime=${formatting.encodeQueryParameter(args.options.fromDateTime)},toDateTime=${toDateTimeParameter})`,
36
- headers: {
37
- accept: 'application/json;odata.metadata=none'
38
- },
39
- responseType: 'json'
40
- };
41
34
  try {
42
- const res = await request.get(requestOptions);
43
- await logger.log(res);
35
+ const response = await odata.getAllItems(`${this.resource}/v1.0/communications/callRecords/getPstnCalls(fromDateTime=${formatting.encodeQueryParameter(args.options.fromDateTime)},toDateTime=${toDateTimeParameter})`);
36
+ await logger.log(response);
44
37
  }
45
38
  catch (err) {
46
39
  this.handleRejectedODataJsonPromise(err);
@@ -9,9 +9,6 @@ export default {
9
9
  ENGAGE_COMMUNITY_USER_ADD: `${prefix} engage community user add`,
10
10
  ENGAGE_COMMUNITY_USER_LIST: `${prefix} engage community user list`,
11
11
  ENGAGE_COMMUNITY_USER_REMOVE: `${prefix} engage community user remove`,
12
- ENGAGE_GROUP_LIST: `${prefix} engage group list`,
13
- ENGAGE_GROUP_USER_ADD: `${prefix} engage group user add`,
14
- ENGAGE_GROUP_USER_REMOVE: `${prefix} engage group user remove`,
15
12
  ENGAGE_MESSAGE_ADD: `${prefix} engage message add`,
16
13
  ENGAGE_MESSAGE_GET: `${prefix} engage message get`,
17
14
  ENGAGE_MESSAGE_LIKE_SET: `${prefix} engage message like set`,
@@ -19,7 +19,7 @@ export const entraAdministrativeUnit = {
19
19
  }
20
20
  }
21
21
  const queryString = queryParameters.length > 0
22
- ? `?${queryParameters.join('&')}`
22
+ ? `&${queryParameters.join('&')}`
23
23
  : '';
24
24
  const graphResource = 'https://graph.microsoft.com';
25
25
  const administrativeUnits = await odata.getAllItems(`${graphResource}/v1.0/directory/administrativeUnits?$filter=displayName eq '${formatting.encodeQueryParameter(displayName)}'${queryString}`);
@@ -143,6 +143,21 @@ export const entraApp = {
143
143
  redirectUris: options.redirectUris.split(',').map(u => u.trim())
144
144
  };
145
145
  }
146
+ if (options.platform === 'android') {
147
+ applicationInfo['publicClient'] = {
148
+ redirectUris: [
149
+ `msauth://${options.bundleId}/${formatting.encodeQueryParameter(options.signatureHash)}`
150
+ ]
151
+ };
152
+ }
153
+ if (options.platform === 'apple') {
154
+ applicationInfo['publicClient'] = {
155
+ redirectUris: [
156
+ `msauth://code/msauth.${options.bundleId}%3A%2F%2Fauth`,
157
+ `msauth.${options.bundleId}://auth`
158
+ ]
159
+ };
160
+ }
146
161
  if (options.implicitFlow) {
147
162
  if (!applicationInfo.web) {
148
163
  applicationInfo.web = {};
@@ -31,7 +31,7 @@ m365 entra appregistration add [options]
31
31
  : Comma-separated list of redirect URIs. Requires `platform` to be specified.
32
32
 
33
33
  `-p, --platform [platform]`
34
- : Platform for which the `redirectUris` should be configured. Allowed values `spa`, `web`, `publicClient`. Requires `redirectUris` to be specified.
34
+ : Platform for which the app should be configured. Allowed values `spa`, `web`, `publicClient`, `apple`, `android`.
35
35
 
36
36
  `--implicitFlow`
37
37
  : Specify, to indicate that the authorization endpoint should return ID and access tokens.
@@ -75,6 +75,12 @@ m365 entra appregistration add [options]
75
75
  `--manifest [manifest]`
76
76
  : App manifest as retrieved from Entra ID to create the app registration from. Specify either `name` or `manifest` but not both.
77
77
 
78
+ `--bundleId [bundleId]`
79
+ : Specify a bundle Id to add the iOS / macOS or Android platform to the application. Required when platform is `apple` or `android`.
80
+
81
+ `--signatureHash [signatureHash]`
82
+ : A required hash when specifying a bundle Id and platform `android`.
83
+
78
84
  `--save`
79
85
  : Use to store the information about the created app in a local file.
80
86
 
@@ -0,0 +1,163 @@
1
+ import Global from '/docs/cmd/_global.mdx';
2
+ import Tabs from '@theme/Tabs';
3
+ import TabItem from '@theme/TabItem';
4
+
5
+ # entra roleassignment add
6
+
7
+ Assign a Entra ID role to a user and specify the scope for which the user has been granted access
8
+
9
+ ## Usage
10
+
11
+ ```sh
12
+ m365 entra roleassignment add [options]
13
+ ```
14
+
15
+ ## Options
16
+
17
+ ```md definition-list
18
+ `--roleDefinitionId [roleDefinitionId]`
19
+ : Id of a role to be assigned. Specify either `roleDefinitionId` or `roleDefinitionName`, but not both.
20
+
21
+ `--roleDefinitionName [roleDefinitionName]`
22
+ : Name of a role to be assigned. Specify either `roleDefinitionId` or `roleDefinitionName`, but not both.
23
+
24
+ `--principal <principal>`
25
+ : Id of a user, group or service principal or user principal name or group mail nickname to which the assignment is granted.
26
+
27
+ `--userId [userId]`
28
+ : Id of a user to which the assignment is scoped.
29
+
30
+ `--userName [userName]`
31
+ : User principal name of a user to which the assignment is scoped.
32
+
33
+ `--administrativeUnitId [administrativeUnitId]`
34
+ : Id of an administrative unit to which the assignment is scoped.
35
+
36
+ `--administrativeUnitName [administrativeUnitName]`
37
+ : Name of an administrative unit to which the assignment is scoped.
38
+
39
+ `--applicationId [applicationId]`
40
+ : Id of an application to which the assignment is scoped.
41
+
42
+ `applicationObjectId [applicationObjectId]`
43
+ : Object Id of an application to which the assignment is scoped.
44
+
45
+ `--applicationName [applicationName]`
46
+ : Name of an application to which the assignment is scoped.
47
+
48
+ `--servicePrincipalId [servicePrincipalId]`
49
+ : Id of a service principal to which the assignment is scoped.
50
+
51
+ `--servicePrincipalName [servicePrincipalName]`
52
+ : Name of a service principal to which the assignment is scoped.
53
+
54
+ `--groupId [groupId]`
55
+ : Id of a group to which the assignment is scoped.
56
+
57
+ `--groupName [groupName]`
58
+ : Name of a group to which the assignment is scoped.
59
+ ```
60
+
61
+ <Global />
62
+
63
+ ## Permissions
64
+
65
+ <Tabs>
66
+ <TabItem value="Delegated">
67
+
68
+ | Resource | Permissions |
69
+ |-----------------|------------------------------------|
70
+ | Microsoft Graph | RoleManagement.ReadWrite.Directory |
71
+
72
+ </TabItem>
73
+ <TabItem value="Application">
74
+
75
+ | Resource | Permissions |
76
+ |-----------------|------------------------------------|
77
+ | Microsoft Graph | RoleManagement.ReadWrite.Directory |
78
+
79
+ </TabItem>
80
+ </Tabs>
81
+
82
+ ## Examples
83
+
84
+ Assign a role specified by name to a user specified by id and scope the assignment to the whole tenant
85
+
86
+ ```sh
87
+ m365 entra roleassignment add --roleDefinitionName 'SharePoint Administrator' --principal 7a2ca997-9461-402e-9882-58088a370889
88
+ ```
89
+
90
+ Assign a role specified by id to a user specified by UPN and scope the assignment to a service principal specified by id
91
+
92
+ ```sh
93
+ m365 entra roleassignment add --roleDefinitionId 777b752-f9b7-4205-a2b1-5db0d6a0ccfc --principal john.doe@contoso.com --servicePrincipalId a4738dd8-fc0f-4646-87fb-47539f5c651b
94
+ ```
95
+
96
+ Assign a role specified by name to a group specified by mail nickname and scope the assignment to an administrative unit specified by name
97
+
98
+ ```sh
99
+ m365 entra roleassignment add --roleDefinitionName 'User Administrator' --principal 'contoso-group' --administrativeUnitName 'Marketing'
100
+ ```
101
+
102
+ Assign a role specified by name to a service principal specified by id and scope the assignment to an application specified by id
103
+
104
+ ```sh
105
+ m365 entra roleassignment add --roleDefinitionName 'Application Administrator' --principal ab2ca997-9461-402e-9882-58088a370889 --applicationId 47539fd8-fc0f-4646-87fb-a4738d5c651b
106
+ ```
107
+
108
+ ## Response
109
+
110
+ <Tabs>
111
+ <TabItem value="JSON">
112
+
113
+ ```json
114
+ {
115
+ "id": "s4awkmfj8k64aR3hKPuYbhaRP4kk4MZLjphUwkUSlIU-1",
116
+ "principalId": "3844129d-f748-4c03-8165-4412ee9b4ceb",
117
+ "directoryScopeId": "/",
118
+ "roleDefinitionId": "92b086b3-e367-4ef2-b869-1de128fb986e"
119
+ }
120
+ ```
121
+
122
+ </TabItem>
123
+ <TabItem value="Text">
124
+
125
+ ```text
126
+ directoryScopeId: /
127
+ id : s4awkmfj8k64aR3hKPuYbhaRP4kk4MZLjphUwkUSlIU-1
128
+ principalId : 3844129d-f748-4c03-8165-4412ee9b4ceb
129
+ roleDefinitionId: 92b086b3-e367-4ef2-b869-1de128fb986e
130
+ ```
131
+
132
+ </TabItem>
133
+ <TabItem value="CSV">
134
+
135
+ ```csv
136
+ id,principalId,directoryScopeId,roleDefinitionId
137
+ s4awkmfj8k64aR3hKPuYbhaRP4kk4MZLjphUwkUSlIU-1,3844129d-f748-4c03-8165-4412ee9b4ceb,/,92b086b3-e367-4ef2-b869-1de128fb986e
138
+ ```
139
+
140
+ </TabItem>
141
+ <TabItem value="Markdown">
142
+
143
+ ```md
144
+ # entra roleassignment add --roleDefinitionId "92b086b3-e367-4ef2-b869-1de128fb986e" --principal "3844129d-f748-4c03-8165-4412ee9b4ceb"
145
+
146
+ Date: 7/3/2025
147
+
148
+ ## s4awkmfj8k64aR3hKPuYbhaRP4kk4MZLjphUwkUSlIU-1
149
+
150
+ Property | Value
151
+ ---------|-------
152
+ id | s4awkmfj8k64aR3hKPuYbhaRP4kk4MZLjphUwkUSlIU-1
153
+ principalId | 3844129d-f748-4c03-8165-4412ee9b4ceb
154
+ directoryScopeId | /
155
+ roleDefinitionId | 92b086b3-e367-4ef2-b869-1de128fb986e
156
+ ```
157
+
158
+ </TabItem>
159
+ </Tabs>
160
+
161
+ ## More information
162
+
163
+ - https://learn.microsoft.com/graph/api/rbacapplication-post-roleassignments