@pnp/cli-microsoft365 10.1.0-beta.f17d225 → 10.2.0-beta.818fb50

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 (110) hide show
  1. package/README.md +2 -2
  2. package/allCommands.json +1 -1
  3. package/allCommandsFull.json +1 -1
  4. package/dist/AuthServer.js +1 -1
  5. package/dist/Command.js +2 -2
  6. package/dist/cli/cli.js +2 -2
  7. package/dist/m365/base/AppCommand.js +5 -2
  8. package/dist/m365/commands/login.js +3 -2
  9. package/dist/m365/entra/commands/administrativeunit/administrativeunit-get.js +18 -4
  10. package/dist/m365/entra/commands/administrativeunit/administrativeunit-list.js +34 -2
  11. package/dist/m365/entra/commands/app/app-get.js +17 -5
  12. package/dist/m365/entra/commands/app/app-list.js +34 -2
  13. package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-add.js +3 -0
  14. package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-get.js +3 -0
  15. package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-list.js +3 -0
  16. package/dist/m365/entra/commands/group/group-get.js +6 -3
  17. package/dist/m365/entra/commands/group/group-list.js +16 -1
  18. package/dist/m365/entra/commands/m365group/m365group-add.js +1 -1
  19. package/dist/m365/entra/commands/m365group/m365group-conversation-list.js +21 -6
  20. package/dist/m365/entra/commands/m365group/m365group-get.js +29 -7
  21. package/dist/m365/entra/commands/m365group/m365group-list.js +1 -1
  22. package/dist/m365/entra/commands/m365group/m365group-remove.js +21 -9
  23. package/dist/m365/entra/commands/m365group/m365group-renew.js +19 -7
  24. package/dist/m365/entra/commands/m365group/m365group-set.js +1 -1
  25. package/dist/m365/entra/commands/m365group/m365group-teamify.js +12 -21
  26. package/dist/m365/file/commands/convert/convert-pdf.js +3 -4
  27. package/dist/m365/file/commands/file-add.js +5 -6
  28. package/dist/m365/graph/commands/subscription/subscription-add.js +46 -5
  29. package/dist/m365/pp/commands/{chatbot/chatbot-get.js → copilot/copilot-get.js} +24 -20
  30. package/dist/m365/pp/commands/{chatbot/chatbot-list.js → copilot/copilot-list.js} +16 -12
  31. package/dist/m365/pp/commands/{chatbot/chatbot-remove.js → copilot/copilot-remove.js} +28 -24
  32. package/dist/m365/pp/commands.js +3 -0
  33. package/dist/m365/spe/ContainerProperties.js +2 -0
  34. package/dist/m365/spe/commands/container/container-list.js +87 -0
  35. package/dist/m365/spe/commands/containertype/containertype-get.js +103 -0
  36. package/dist/m365/spe/commands/containertype/containertype-list.js +2 -22
  37. package/dist/m365/spe/commands.js +2 -0
  38. package/dist/m365/spfx/commands/package/package-generate.js +1 -1
  39. package/dist/m365/spfx/commands/project/JsonRule.js +2 -2
  40. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN016004_TS_property_pane_property_import.js +2 -2
  41. package/dist/m365/spfx/commands/spfx-doctor.js +1 -1
  42. package/dist/m365/spo/commands/contenttype/contenttype-get.js +2 -2
  43. package/dist/m365/spo/commands/contenttype/contenttype-list.js +6 -3
  44. package/dist/m365/spo/commands/file/file-add.js +1 -1
  45. package/dist/m365/spo/commands/file/file-retentionlabel-ensure.js +1 -2
  46. package/dist/m365/spo/commands/file/file-retentionlabel-remove.js +1 -2
  47. package/dist/m365/spo/commands/folder/folder-retentionlabel-ensure.js +1 -2
  48. package/dist/m365/spo/commands/folder/folder-retentionlabel-remove.js +1 -2
  49. package/dist/m365/spo/commands/list/list-contenttype-list.js +5 -2
  50. package/dist/m365/spo/commands/listitem/listitem-batch-remove.js +10 -8
  51. package/dist/m365/spo/commands/listitem/listitem-batch-set.js +1 -1
  52. package/dist/m365/spo/commands/listitem/listitem-retentionlabel-ensure.js +1 -2
  53. package/dist/m365/spo/commands/listitem/listitem-retentionlabel-remove.js +1 -2
  54. package/dist/m365/spo/commands/page/page-add.js +1 -1
  55. package/dist/m365/spo/commands/site/site-admin-add.js +4 -12
  56. package/dist/m365/spo/commands/site/site-admin-list.js +3 -11
  57. package/dist/m365/spo/commands/site/site-admin-remove.js +4 -12
  58. package/dist/m365/spo/commands/site/site-set.js +1 -1
  59. package/dist/m365/spp/commands/model/model-remove.js +105 -0
  60. package/dist/m365/spp/commands.js +2 -1
  61. package/dist/m365/teams/commands/user/user-app-list.js +1 -1
  62. package/dist/m365/tenant/commands/report/report-office365activationcounts.js +2 -8
  63. package/dist/m365/tenant/commands/report/report-office365activationsusercounts.js +2 -8
  64. package/dist/m365/tenant/commands/report/report-office365activationsuserdetail.js +2 -8
  65. package/dist/m365/todo/commands/list/list-remove.js +2 -1
  66. package/dist/m365/todo/commands/list/list-set.js +2 -1
  67. package/dist/m365/todo/commands/task/task-add.js +2 -1
  68. package/dist/m365/todo/commands/task/task-get.js +2 -1
  69. package/dist/m365/todo/commands/task/task-list.js +2 -1
  70. package/dist/m365/todo/commands/task/task-remove.js +2 -1
  71. package/dist/m365/todo/commands/task/task-set.js +1 -1
  72. package/dist/m365/viva/commands/engage/engage-community-set.js +111 -0
  73. package/dist/m365/viva/commands.js +1 -0
  74. package/dist/utils/entraAdministrativeUnit.js +14 -2
  75. package/dist/utils/entraGroup.js +49 -6
  76. package/dist/utils/formatting.js +8 -20
  77. package/dist/utils/spo.js +23 -4
  78. package/dist/utils/spp.js +3 -3
  79. package/dist/utils/urlUtil.js +11 -14
  80. package/docs/docs/cmd/entra/administrativeunit/administrativeunit-get.mdx +10 -3
  81. package/docs/docs/cmd/entra/administrativeunit/administrativeunit-list.mdx +16 -1
  82. package/docs/docs/cmd/entra/app/app-get.mdx +13 -8
  83. package/docs/docs/cmd/entra/app/app-list.mdx +16 -1
  84. package/docs/docs/cmd/entra/group/group-get.mdx +10 -3
  85. package/docs/docs/cmd/entra/group/group-list.mdx +9 -2
  86. package/docs/docs/cmd/entra/m365group/m365group-conversation-list.mdx +12 -3
  87. package/docs/docs/cmd/entra/m365group/m365group-get.mdx +29 -5
  88. package/docs/docs/cmd/entra/m365group/m365group-remove.mdx +7 -4
  89. package/docs/docs/cmd/entra/m365group/m365group-renew.mdx +11 -2
  90. package/docs/docs/cmd/entra/m365group/m365group-teamify.mdx +12 -3
  91. package/docs/docs/cmd/entra/m365group/m365group-user-add.mdx +2 -2
  92. package/docs/docs/cmd/entra/m365group/m365group-user-list.mdx +6 -0
  93. package/docs/docs/cmd/entra/m365group/m365group-user-remove.mdx +1 -1
  94. package/docs/docs/cmd/entra/m365group/m365group-user-set.mdx +3 -3
  95. package/docs/docs/cmd/graph/subscription/subscription-add.mdx +30 -5
  96. package/docs/docs/cmd/login.mdx +45 -44
  97. package/docs/docs/cmd/pp/{chatbot/chatbot-get.mdx → copilot/copilot-get.mdx} +24 -18
  98. package/docs/docs/cmd/pp/{chatbot/chatbot-list.mdx → copilot/copilot-list.mdx} +20 -14
  99. package/docs/docs/cmd/pp/{chatbot/chatbot-remove.mdx → copilot/copilot-remove.mdx} +16 -10
  100. package/docs/docs/cmd/pp/managementapp/managementapp-add.mdx +1 -1
  101. package/docs/docs/cmd/spe/container/container-list.mdx +97 -0
  102. package/docs/docs/cmd/spe/containertype/containertype-get.mdx +114 -0
  103. package/docs/docs/cmd/spo/contenttype/contenttype-get.mdx +7 -1
  104. package/docs/docs/cmd/spo/contenttype/contenttype-list.mdx +7 -1
  105. package/docs/docs/cmd/spo/list/list-contenttype-list.mdx +7 -1
  106. package/docs/docs/cmd/spp/model/model-remove.mdx +57 -0
  107. package/docs/docs/cmd/viva/engage/engage-community-set.mdx +61 -0
  108. package/npm-shrinkwrap.json +8 -2
  109. package/package.json +4 -2
  110. package/dist/m365/spe/ContainerTypeProperties.js +0 -2
@@ -17,7 +17,7 @@ export class AuthServer {
17
17
  this.httpServer = http.createServer(this.httpRequest).listen(0, this.httpListener);
18
18
  };
19
19
  this.httpListener = async () => {
20
- const requestState = Math.random().toString(16).substr(2, 20);
20
+ const requestState = Math.random().toString(16).substring(2, 22);
21
21
  const address = this.httpServer.address();
22
22
  this.generatedServerUrl = `http://localhost:${address.port}`;
23
23
  const url = `${Auth.getEndpointForResource('https://login.microsoftonline.com', this.connection.cloudType)}/${this.connection.tenant}/oauth2/authorize?response_type=code&client_id=${this.connection.appId}&redirect_uri=${this.generatedServerUrl}&state=${requestState}&resource=${this.resource}&prompt=select_account`;
package/dist/Command.js CHANGED
@@ -234,7 +234,7 @@ class Command {
234
234
  if (pos1 > -1) {
235
235
  pos = pos1;
236
236
  }
237
- commandName = commandName.substr(0, pos).trim();
237
+ commandName = commandName.substring(0, pos).trim();
238
238
  }
239
239
  return commandName;
240
240
  }
@@ -572,7 +572,7 @@ class Command {
572
572
  logItem.name ?? logItem.Name;
573
573
  }
574
574
  getLogItemId(logItem) {
575
- return logItem.id ?? logItem.Id ?? logItem.ID ??
575
+ return logItem.id ?? logItem.Id?.StringValue ?? logItem.Id ?? logItem.ID ??
576
576
  logItem.uniqueId ?? logItem.UniqueId ??
577
577
  logItem.objectId ?? logItem.ObjectId ??
578
578
  logItem.url ?? logItem.Url ?? logItem.URL;
package/dist/cli/cli.js CHANGED
@@ -702,7 +702,7 @@ function printAvailableCommands() {
702
702
  commandsToPrint[commandName] = command;
703
703
  }
704
704
  else {
705
- const subCommandsGroup = commandName.substr(0, pos);
705
+ const subCommandsGroup = commandName.substring(0, pos);
706
706
  if (!commandGroupsToPrint[subCommandsGroup]) {
707
707
  commandGroupsToPrint[subCommandsGroup] = 0;
708
708
  }
@@ -867,7 +867,7 @@ function loadOptionValuesFromFiles(args) {
867
867
  !value.startsWith('@')) {
868
868
  return;
869
869
  }
870
- const filePath = value.substr(1);
870
+ const filePath = value.substring(1);
871
871
  // if the file doesn't exist, leave as-is, if it exists replace with
872
872
  // contents from the file
873
873
  if (fs.existsSync(filePath)) {
@@ -53,9 +53,12 @@ class AppCommand extends Command {
53
53
  return super.action(logger, args);
54
54
  }
55
55
  if (this.m365rcJson.apps.length > 1) {
56
- const resultAsKeyValuePair = formatting.convertArrayToHashTable('appIdIndex', this.m365rcJson.apps);
56
+ this.m365rcJson.apps.forEach((app, index) => {
57
+ app.appIdIndex = index;
58
+ });
59
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('appId', this.m365rcJson.apps);
57
60
  const result = await cli.handleMultipleResultsFound(`Multiple Entra apps found in ${m365rcJsonPath}.`, resultAsKeyValuePair);
58
- this.appId = this.m365rcJson.apps[result.appIdIndex].appId;
61
+ this.appId = result.appId;
59
62
  await super.action(logger, args);
60
63
  }
61
64
  }
@@ -37,8 +37,9 @@ class LoginCommand extends Command {
37
37
  }
38
38
  getRefinedSchema(schema) {
39
39
  return schema
40
- .refine(options => typeof options.appId !== 'undefined' || cli.getConfig().get(settingsNames.clientId), {
41
- message: `appId is required. TIP: use the "m365 setup" command to configure the default appId`
40
+ .refine(options => typeof options.appId !== 'undefined' || cli.getClientId(), {
41
+ message: `appId is required. TIP: use the "m365 setup" command to configure the default appId`,
42
+ path: ['appId']
42
43
  })
43
44
  .refine(options => options.authType !== 'password' || options.userName, {
44
45
  message: 'Username is required when using password authentication',
@@ -29,7 +29,7 @@ class EntraAdministrativeUnitGetCommand extends GraphCommand {
29
29
  let administrativeUnit;
30
30
  try {
31
31
  if (args.options.id) {
32
- administrativeUnit = await this.getAdministrativeUnitById(args.options.id);
32
+ administrativeUnit = await this.getAdministrativeUnitById(args.options.id, args.options.properties);
33
33
  }
34
34
  else {
35
35
  administrativeUnit = await entraAdministrativeUnit.getAdministrativeUnitByDisplayName(args.options.displayName);
@@ -40,9 +40,20 @@ class EntraAdministrativeUnitGetCommand extends GraphCommand {
40
40
  this.handleRejectedODataJsonPromise(err);
41
41
  }
42
42
  }
43
- async getAdministrativeUnitById(id) {
43
+ async getAdministrativeUnitById(id, properties) {
44
+ const queryParameters = [];
45
+ if (properties) {
46
+ const allProperties = properties.split(',');
47
+ const selectProperties = allProperties.filter(prop => !prop.includes('/'));
48
+ if (selectProperties.length > 0) {
49
+ queryParameters.push(`$select=${selectProperties}`);
50
+ }
51
+ }
52
+ const queryString = queryParameters.length > 0
53
+ ? `?${queryParameters.join('&')}`
54
+ : '';
44
55
  const requestOptions = {
45
- url: `${this.resource}/v1.0/directory/administrativeUnits/${id}`,
56
+ url: `${this.resource}/v1.0/directory/administrativeUnits/${id}${queryString}`,
46
57
  headers: {
47
58
  accept: 'application/json;odata.metadata=none'
48
59
  },
@@ -55,7 +66,8 @@ _EntraAdministrativeUnitGetCommand_instances = new WeakSet(), _EntraAdministrati
55
66
  this.telemetry.push((args) => {
56
67
  Object.assign(this.telemetryProperties, {
57
68
  id: typeof args.options.id !== 'undefined',
58
- displayName: typeof args.options.displayName !== 'undefined'
69
+ displayName: typeof args.options.displayName !== 'undefined',
70
+ properties: typeof args.options.properties !== 'undefined'
59
71
  });
60
72
  });
61
73
  }, _EntraAdministrativeUnitGetCommand_initOptions = function _EntraAdministrativeUnitGetCommand_initOptions() {
@@ -63,6 +75,8 @@ _EntraAdministrativeUnitGetCommand_instances = new WeakSet(), _EntraAdministrati
63
75
  option: '-i, --id [id]'
64
76
  }, {
65
77
  option: '-n, --displayName [displayName]'
78
+ }, {
79
+ option: '-p, --properties [properties]'
66
80
  });
67
81
  }, _EntraAdministrativeUnitGetCommand_initValidators = function _EntraAdministrativeUnitGetCommand_initValidators() {
68
82
  this.validators.push(async (args) => {
@@ -1,3 +1,9 @@
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 _EntraAdministrativeUnitListCommand_instances, _EntraAdministrativeUnitListCommand_initTelemetry, _EntraAdministrativeUnitListCommand_initOptions;
1
7
  import { odata } from '../../../../utils/odata.js';
2
8
  import GraphCommand from '../../../base/GraphCommand.js';
3
9
  import commands from '../../commands.js';
@@ -11,9 +17,26 @@ class EntraAdministrativeUnitListCommand extends GraphCommand {
11
17
  defaultProperties() {
12
18
  return ['id', 'displayName', 'visibility'];
13
19
  }
14
- async commandAction(logger) {
20
+ constructor() {
21
+ super();
22
+ _EntraAdministrativeUnitListCommand_instances.add(this);
23
+ __classPrivateFieldGet(this, _EntraAdministrativeUnitListCommand_instances, "m", _EntraAdministrativeUnitListCommand_initTelemetry).call(this);
24
+ __classPrivateFieldGet(this, _EntraAdministrativeUnitListCommand_instances, "m", _EntraAdministrativeUnitListCommand_initOptions).call(this);
25
+ }
26
+ async commandAction(logger, args) {
27
+ const queryParameters = [];
28
+ if (args.options.properties) {
29
+ const allProperties = args.options.properties.split(',');
30
+ const selectProperties = allProperties.filter(prop => !prop.includes('/'));
31
+ if (selectProperties.length > 0) {
32
+ queryParameters.push(`$select=${selectProperties}`);
33
+ }
34
+ }
35
+ const queryString = queryParameters.length > 0
36
+ ? `?${queryParameters.join('&')}`
37
+ : '';
15
38
  try {
16
- const results = await odata.getAllItems(`${this.resource}/v1.0/directory/administrativeUnits`);
39
+ const results = await odata.getAllItems(`${this.resource}/v1.0/directory/administrativeUnits${queryString}`);
17
40
  await logger.log(results);
18
41
  }
19
42
  catch (err) {
@@ -21,5 +44,14 @@ class EntraAdministrativeUnitListCommand extends GraphCommand {
21
44
  }
22
45
  }
23
46
  }
47
+ _EntraAdministrativeUnitListCommand_instances = new WeakSet(), _EntraAdministrativeUnitListCommand_initTelemetry = function _EntraAdministrativeUnitListCommand_initTelemetry() {
48
+ this.telemetry.push((args) => {
49
+ Object.assign(this.telemetryProperties, {
50
+ properties: typeof args.options.properties !== 'undefined'
51
+ });
52
+ });
53
+ }, _EntraAdministrativeUnitListCommand_initOptions = function _EntraAdministrativeUnitListCommand_initOptions() {
54
+ this.options.unshift({ option: '-p, --properties [properties]' });
55
+ };
24
56
  export default new EntraAdministrativeUnitListCommand();
25
57
  //# sourceMappingURL=administrativeunit-list.js.map
@@ -29,7 +29,7 @@ class EntraAppGetCommand extends GraphCommand {
29
29
  async commandAction(logger, args) {
30
30
  try {
31
31
  const appObjectId = await this.getAppObjectId(args);
32
- const appInfo = await this.getAppInfo(appObjectId);
32
+ const appInfo = await this.getAppInfo(appObjectId, args.options.properties);
33
33
  const res = await this.saveAppInfo(args, appInfo, logger);
34
34
  await logger.log(res);
35
35
  }
@@ -64,9 +64,20 @@ class EntraAppGetCommand extends GraphCommand {
64
64
  const result = await cli.handleMultipleResultsFound(`Multiple Microsoft Entra application registrations with name '${name}' found.`, resultAsKeyValuePair);
65
65
  return result.id;
66
66
  }
67
- async getAppInfo(appObjectId) {
67
+ async getAppInfo(appObjectId, properties) {
68
+ const queryParameters = [];
69
+ if (properties) {
70
+ const allProperties = properties.split(',');
71
+ const selectProperties = allProperties.filter(prop => !prop.includes('/'));
72
+ if (selectProperties.length > 0) {
73
+ queryParameters.push(`$select=${selectProperties}`);
74
+ }
75
+ }
76
+ const queryString = queryParameters.length > 0
77
+ ? `?${queryParameters.join('&')}`
78
+ : '';
68
79
  const requestOptions = {
69
- url: `${this.resource}/v1.0/myorganization/applications/${appObjectId}`,
80
+ url: `${this.resource}/v1.0/myorganization/applications/${appObjectId}${queryString}`,
70
81
  headers: {
71
82
  accept: 'application/json;odata.metadata=none'
72
83
  },
@@ -121,11 +132,12 @@ _EntraAppGetCommand_instances = new WeakSet(), _EntraAppGetCommand_initTelemetry
121
132
  Object.assign(this.telemetryProperties, {
122
133
  appId: typeof args.options.appId !== 'undefined',
123
134
  objectId: typeof args.options.objectId !== 'undefined',
124
- name: typeof args.options.name !== 'undefined'
135
+ name: typeof args.options.name !== 'undefined',
136
+ properties: typeof args.options.properties !== 'undefined'
125
137
  });
126
138
  });
127
139
  }, _EntraAppGetCommand_initOptions = function _EntraAppGetCommand_initOptions() {
128
- this.options.unshift({ option: '--appId [appId]' }, { option: '--objectId [objectId]' }, { option: '--name [name]' }, { option: '--save' });
140
+ this.options.unshift({ option: '--appId [appId]' }, { option: '--objectId [objectId]' }, { option: '--name [name]' }, { option: '--save' }, { option: '-p, --properties [properties]' });
129
141
  }, _EntraAppGetCommand_initValidators = function _EntraAppGetCommand_initValidators() {
130
142
  this.validators.push(async (args) => {
131
143
  if (args.options.appId && !validation.isValidGuid(args.options.appId)) {
@@ -1,3 +1,9 @@
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 _EntraAppListCommand_instances, _EntraAppListCommand_initTelemetry, _EntraAppListCommand_initOptions;
1
7
  import { odata } from "../../../../utils/odata.js";
2
8
  import GraphCommand from '../../../base/GraphCommand.js';
3
9
  import commands from '../../commands.js';
@@ -8,12 +14,29 @@ class EntraAppListCommand extends GraphCommand {
8
14
  get description() {
9
15
  return 'Retrieves a list of Entra app registrations';
10
16
  }
17
+ constructor() {
18
+ super();
19
+ _EntraAppListCommand_instances.add(this);
20
+ __classPrivateFieldGet(this, _EntraAppListCommand_instances, "m", _EntraAppListCommand_initTelemetry).call(this);
21
+ __classPrivateFieldGet(this, _EntraAppListCommand_instances, "m", _EntraAppListCommand_initOptions).call(this);
22
+ }
11
23
  defaultProperties() {
12
24
  return ['appId', 'id', 'displayName', "signInAudience"];
13
25
  }
14
- async commandAction(logger) {
26
+ async commandAction(logger, args) {
27
+ const queryParameters = [];
28
+ if (args.options.properties) {
29
+ const allProperties = args.options.properties.split(',');
30
+ const selectProperties = allProperties.filter(prop => !prop.includes('/'));
31
+ if (selectProperties.length > 0) {
32
+ queryParameters.push(`$select=${selectProperties}`);
33
+ }
34
+ }
35
+ const queryString = queryParameters.length > 0
36
+ ? `?${queryParameters.join('&')}`
37
+ : '';
15
38
  try {
16
- const results = await odata.getAllItems(`${this.resource}/v1.0/applications`);
39
+ const results = await odata.getAllItems(`${this.resource}/v1.0/applications${queryString}`);
17
40
  await logger.log(results);
18
41
  }
19
42
  catch (err) {
@@ -21,5 +44,14 @@ class EntraAppListCommand extends GraphCommand {
21
44
  }
22
45
  }
23
46
  }
47
+ _EntraAppListCommand_instances = new WeakSet(), _EntraAppListCommand_initTelemetry = function _EntraAppListCommand_initTelemetry() {
48
+ this.telemetry.push((args) => {
49
+ Object.assign(this.telemetryProperties, {
50
+ properties: typeof args.options.properties !== 'undefined'
51
+ });
52
+ });
53
+ }, _EntraAppListCommand_initOptions = function _EntraAppListCommand_initOptions() {
54
+ this.options.unshift({ option: '-p, --properties [properties]' });
55
+ };
24
56
  export default new EntraAppListCommand();
25
57
  //# sourceMappingURL=app-list.js.map
@@ -17,6 +17,9 @@ class EntraEnterpriseAppAddCommand extends GraphCommand {
17
17
  get description() {
18
18
  return 'Creates an enterprise application (or service principal) for a registered Entra app';
19
19
  }
20
+ alias() {
21
+ return [commands.SP_ADD];
22
+ }
20
23
  constructor() {
21
24
  super();
22
25
  _EntraEnterpriseAppAddCommand_instances.add(this);
@@ -17,6 +17,9 @@ class EntraEnterpriseAppGetCommand extends GraphCommand {
17
17
  get description() {
18
18
  return 'Gets information about an Enterprise Application';
19
19
  }
20
+ alias() {
21
+ return [commands.SP_GET];
22
+ }
20
23
  constructor() {
21
24
  super();
22
25
  _EntraEnterpriseAppGetCommand_instances.add(this);
@@ -17,6 +17,9 @@ class EntraEnterpriseAppListCommand extends GraphCommand {
17
17
  get description() {
18
18
  return 'Lists the enterprise applications (or service principals) in Entra ID';
19
19
  }
20
+ alias() {
21
+ return [commands.SP_LIST];
22
+ }
20
23
  constructor() {
21
24
  super();
22
25
  _EntraEnterpriseAppListCommand_instances.add(this);
@@ -27,10 +27,10 @@ class EntraGroupGetCommand extends GraphCommand {
27
27
  let group;
28
28
  try {
29
29
  if (args.options.id) {
30
- group = await entraGroup.getGroupById(args.options.id);
30
+ group = await entraGroup.getGroupById(args.options.id, args.options.properties);
31
31
  }
32
32
  else {
33
- group = await entraGroup.getGroupByDisplayName(args.options.displayName);
33
+ group = await entraGroup.getGroupByDisplayName(args.options.displayName, args.options.properties);
34
34
  }
35
35
  await logger.log(group);
36
36
  }
@@ -44,6 +44,8 @@ _EntraGroupGetCommand_instances = new WeakSet(), _EntraGroupGetCommand_initOptio
44
44
  option: '-i, --id [id]'
45
45
  }, {
46
46
  option: '-n, --displayName [displayName]'
47
+ }, {
48
+ option: '-p, --properties [properties]'
47
49
  });
48
50
  }, _EntraGroupGetCommand_initValidators = function _EntraGroupGetCommand_initValidators() {
49
51
  this.validators.push(async (args) => {
@@ -58,7 +60,8 @@ _EntraGroupGetCommand_instances = new WeakSet(), _EntraGroupGetCommand_initOptio
58
60
  this.telemetry.push((args) => {
59
61
  Object.assign(this.telemetryProperties, {
60
62
  id: typeof args.options.id !== 'undefined',
61
- displayName: typeof args.options.displayName !== 'undefined'
63
+ displayName: typeof args.options.displayName !== 'undefined',
64
+ properties: typeof args.options.properties !== 'undefined'
62
65
  });
63
66
  });
64
67
  };
@@ -47,6 +47,18 @@ class EntraGroupListCommand extends GraphCommand {
47
47
  break;
48
48
  }
49
49
  }
50
+ const queryParameters = [];
51
+ if (args.options.properties) {
52
+ const allProperties = args.options.properties.split(',');
53
+ const selectProperties = allProperties.filter(prop => !prop.includes('/'));
54
+ if (selectProperties.length > 0) {
55
+ queryParameters.push(`$select=${selectProperties}`);
56
+ }
57
+ }
58
+ const queryString = queryParameters.length > 0
59
+ ? `?${queryParameters.join('&')}`
60
+ : '';
61
+ requestUrl += queryString;
50
62
  let groups = [];
51
63
  if (useConsistencyLevelHeader) {
52
64
  // While using not() function in the filter, we need to specify the ConsistencyLevel header.
@@ -89,13 +101,16 @@ class EntraGroupListCommand extends GraphCommand {
89
101
  _a = EntraGroupListCommand, _EntraGroupListCommand_instances = new WeakSet(), _EntraGroupListCommand_initTelemetry = function _EntraGroupListCommand_initTelemetry() {
90
102
  this.telemetry.push((args) => {
91
103
  Object.assign(this.telemetryProperties, {
92
- type: typeof args.options.type !== 'undefined'
104
+ type: typeof args.options.type !== 'undefined',
105
+ properties: typeof args.options.properties !== 'undefined'
93
106
  });
94
107
  });
95
108
  }, _EntraGroupListCommand_initOptions = function _EntraGroupListCommand_initOptions() {
96
109
  this.options.unshift({
97
110
  option: '--type [type]',
98
111
  autocomplete: _a.groupTypes
112
+ }, {
113
+ option: '-p, --properties [properties]'
99
114
  });
100
115
  }, _EntraGroupListCommand_initValidators = function _EntraGroupListCommand_initValidators() {
101
116
  this.validators.push(async (args) => {
@@ -171,7 +171,7 @@ class EntraM365GroupAddCommand extends GraphCommand {
171
171
  }
172
172
  }
173
173
  getImageContentType(imagePath) {
174
- const extension = imagePath.substr(imagePath.lastIndexOf('.')).toLowerCase();
174
+ const extension = imagePath.substring(imagePath.lastIndexOf('.')).toLowerCase();
175
175
  switch (extension) {
176
176
  case '.png':
177
177
  return 'image/png';
@@ -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 _EntraM365GroupConversationListCommand_instances, _EntraM365GroupConversationListCommand_initOptions, _EntraM365GroupConversationListCommand_initValidators;
6
+ var _EntraM365GroupConversationListCommand_instances, _EntraM365GroupConversationListCommand_initOptions, _EntraM365GroupConversationListCommand_initValidators, _EntraM365GroupConversationListCommand_initOptionSets, _EntraM365GroupConversationListCommand_initTypes;
7
7
  import { odata } from '../../../../utils/odata.js';
8
8
  import { validation } from '../../../../utils/validation.js';
9
9
  import GraphCommand from '../../../base/GraphCommand.js';
@@ -24,14 +24,23 @@ class EntraM365GroupConversationListCommand extends GraphCommand {
24
24
  _EntraM365GroupConversationListCommand_instances.add(this);
25
25
  __classPrivateFieldGet(this, _EntraM365GroupConversationListCommand_instances, "m", _EntraM365GroupConversationListCommand_initOptions).call(this);
26
26
  __classPrivateFieldGet(this, _EntraM365GroupConversationListCommand_instances, "m", _EntraM365GroupConversationListCommand_initValidators).call(this);
27
+ __classPrivateFieldGet(this, _EntraM365GroupConversationListCommand_instances, "m", _EntraM365GroupConversationListCommand_initOptionSets).call(this);
28
+ __classPrivateFieldGet(this, _EntraM365GroupConversationListCommand_instances, "m", _EntraM365GroupConversationListCommand_initTypes).call(this);
27
29
  }
28
30
  async commandAction(logger, args) {
31
+ if (this.verbose) {
32
+ await logger.logToStderr(`Retrieving conversations for Microsoft 365 Group: ${args.options.groupId || args.options.groupName}...`);
33
+ }
29
34
  try {
30
- const isUnifiedGroup = await entraGroup.isUnifiedGroup(args.options.groupId);
35
+ let groupId = args.options.groupId;
36
+ if (args.options.groupName) {
37
+ groupId = await entraGroup.getGroupIdByDisplayName(args.options.groupName);
38
+ }
39
+ const isUnifiedGroup = await entraGroup.isUnifiedGroup(groupId);
31
40
  if (!isUnifiedGroup) {
32
- throw Error(`Specified group with id '${args.options.groupId}' is not a Microsoft 365 group.`);
41
+ throw Error(`Specified group with id '${groupId}' is not a Microsoft 365 group.`);
33
42
  }
34
- const conversations = await odata.getAllItems(`${this.resource}/v1.0/groups/${args.options.groupId}/conversations`);
43
+ const conversations = await odata.getAllItems(`${this.resource}/v1.0/groups/${groupId}/conversations`);
35
44
  await logger.log(conversations);
36
45
  }
37
46
  catch (err) {
@@ -41,15 +50,21 @@ class EntraM365GroupConversationListCommand extends GraphCommand {
41
50
  }
42
51
  _EntraM365GroupConversationListCommand_instances = new WeakSet(), _EntraM365GroupConversationListCommand_initOptions = function _EntraM365GroupConversationListCommand_initOptions() {
43
52
  this.options.unshift({
44
- option: '-i, --groupId <groupId>'
53
+ option: '-i, --groupId [groupId]'
54
+ }, {
55
+ option: '-n, --groupName [groupName]'
45
56
  });
46
57
  }, _EntraM365GroupConversationListCommand_initValidators = function _EntraM365GroupConversationListCommand_initValidators() {
47
58
  this.validators.push(async (args) => {
48
- if (!validation.isValidGuid(args.options.groupId)) {
59
+ if (args.options.groupId && !validation.isValidGuid(args.options.groupId)) {
49
60
  return `${args.options.groupId} is not a valid GUID`;
50
61
  }
51
62
  return true;
52
63
  });
64
+ }, _EntraM365GroupConversationListCommand_initOptionSets = function _EntraM365GroupConversationListCommand_initOptionSets() {
65
+ this.optionSets.push({ options: ['groupId', 'groupName'] });
66
+ }, _EntraM365GroupConversationListCommand_initTypes = function _EntraM365GroupConversationListCommand_initTypes() {
67
+ this.types.string.push('groupId', 'groupName');
53
68
  };
54
69
  export default new EntraM365GroupConversationListCommand();
55
70
  //# sourceMappingURL=m365group-conversation-list.js.map
@@ -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 _EntraM365GroupGetCommand_instances, _EntraM365GroupGetCommand_initOptions, _EntraM365GroupGetCommand_initValidators;
6
+ var _EntraM365GroupGetCommand_instances, _EntraM365GroupGetCommand_initOptions, _EntraM365GroupGetCommand_initValidators, _EntraM365GroupGetCommand_initOptionSets, _EntraM365GroupGetCommand_initTypes;
7
7
  import request from '../../../../request.js';
8
8
  import { entraGroup } from '../../../../utils/entraGroup.js';
9
9
  import { validation } from '../../../../utils/validation.js';
@@ -21,15 +21,31 @@ class EntraM365GroupGetCommand extends GraphCommand {
21
21
  _EntraM365GroupGetCommand_instances.add(this);
22
22
  __classPrivateFieldGet(this, _EntraM365GroupGetCommand_instances, "m", _EntraM365GroupGetCommand_initOptions).call(this);
23
23
  __classPrivateFieldGet(this, _EntraM365GroupGetCommand_instances, "m", _EntraM365GroupGetCommand_initValidators).call(this);
24
+ __classPrivateFieldGet(this, _EntraM365GroupGetCommand_instances, "m", _EntraM365GroupGetCommand_initOptionSets).call(this);
25
+ __classPrivateFieldGet(this, _EntraM365GroupGetCommand_instances, "m", _EntraM365GroupGetCommand_initTypes).call(this);
24
26
  }
25
27
  async commandAction(logger, args) {
26
28
  let group;
27
29
  try {
28
- const isUnifiedGroup = await entraGroup.isUnifiedGroup(args.options.id);
30
+ if (args.options.id) {
31
+ group = await entraGroup.getGroupById(args.options.id);
32
+ }
33
+ else {
34
+ group = await entraGroup.getGroupByDisplayName(args.options.displayName);
35
+ }
36
+ const isUnifiedGroup = await entraGroup.isUnifiedGroup(group.id);
29
37
  if (!isUnifiedGroup) {
30
- throw Error(`Specified group with id '${args.options.id}' is not a Microsoft 365 group.`);
38
+ throw Error(`Specified group with id '${group.id}' is not a Microsoft 365 group.`);
31
39
  }
32
- group = await entraGroup.getGroupById(args.options.id);
40
+ const requestExtendedOptions = {
41
+ url: `${this.resource}/v1.0/groups/${group.id}?$select=allowExternalSenders,autoSubscribeNewMembers,hideFromAddressLists,hideFromOutlookClients,isSubscribedByMail`,
42
+ headers: {
43
+ accept: 'application/json;odata.metadata=none'
44
+ },
45
+ responseType: 'json'
46
+ };
47
+ const groupExtended = await request.get(requestExtendedOptions);
48
+ group = { ...group, ...groupExtended };
33
49
  if (args.options.includeSiteUrl) {
34
50
  const requestOptions = {
35
51
  url: `${this.resource}/v1.0/groups/${group.id}/drive?$select=webUrl`,
@@ -39,7 +55,7 @@ class EntraM365GroupGetCommand extends GraphCommand {
39
55
  responseType: 'json'
40
56
  };
41
57
  const res = await request.get(requestOptions);
42
- group.siteUrl = res.webUrl ? res.webUrl.substr(0, res.webUrl.lastIndexOf('/')) : '';
58
+ group.siteUrl = res.webUrl ? res.webUrl.substring(0, res.webUrl.lastIndexOf('/')) : '';
43
59
  }
44
60
  await logger.log(group);
45
61
  }
@@ -50,17 +66,23 @@ class EntraM365GroupGetCommand extends GraphCommand {
50
66
  }
51
67
  _EntraM365GroupGetCommand_instances = new WeakSet(), _EntraM365GroupGetCommand_initOptions = function _EntraM365GroupGetCommand_initOptions() {
52
68
  this.options.unshift({
53
- option: '-i, --id <id>'
69
+ option: '-i, --id [id]'
70
+ }, {
71
+ option: '-n, --displayName [displayName]'
54
72
  }, {
55
73
  option: '--includeSiteUrl'
56
74
  });
57
75
  }, _EntraM365GroupGetCommand_initValidators = function _EntraM365GroupGetCommand_initValidators() {
58
76
  this.validators.push(async (args) => {
59
- if (!validation.isValidGuid(args.options.id)) {
77
+ if (args.options.id && !validation.isValidGuid(args.options.id)) {
60
78
  return `${args.options.id} is not a valid GUID`;
61
79
  }
62
80
  return true;
63
81
  });
82
+ }, _EntraM365GroupGetCommand_initOptionSets = function _EntraM365GroupGetCommand_initOptionSets() {
83
+ this.optionSets.push({ options: ['id', 'displayName'] });
84
+ }, _EntraM365GroupGetCommand_initTypes = function _EntraM365GroupGetCommand_initTypes() {
85
+ this.types.string.push('id', 'displayName');
64
86
  };
65
87
  export default new EntraM365GroupGetCommand();
66
88
  //# sourceMappingURL=m365group-get.js.map
@@ -72,7 +72,7 @@ class EntraM365GroupListCommand extends GraphCommand {
72
72
  const res = await request.get(requestOptions);
73
73
  return {
74
74
  id: groupId,
75
- url: res.webUrl ? res.webUrl.substr(0, res.webUrl.lastIndexOf('/')) : ''
75
+ url: res.webUrl ? res.webUrl.substring(0, res.webUrl.lastIndexOf('/')) : ''
76
76
  };
77
77
  }
78
78
  }
@@ -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 _EntraM365GroupRemoveCommand_instances, _EntraM365GroupRemoveCommand_initTelemetry, _EntraM365GroupRemoveCommand_initOptions, _EntraM365GroupRemoveCommand_initValidators;
6
+ var _EntraM365GroupRemoveCommand_instances, _EntraM365GroupRemoveCommand_initTelemetry, _EntraM365GroupRemoveCommand_initOptions, _EntraM365GroupRemoveCommand_initValidators, _EntraM365GroupRemoveCommand_initOptionSets, _EntraM365GroupRemoveCommand_initTypes;
7
7
  import { cli } from '../../../../cli/cli.js';
8
8
  import request from '../../../../request.js';
9
9
  import { entraGroup } from '../../../../utils/entraGroup.js';
@@ -28,23 +28,29 @@ class EntraM365GroupRemoveCommand extends GraphCommand {
28
28
  __classPrivateFieldGet(this, _EntraM365GroupRemoveCommand_instances, "m", _EntraM365GroupRemoveCommand_initTelemetry).call(this);
29
29
  __classPrivateFieldGet(this, _EntraM365GroupRemoveCommand_instances, "m", _EntraM365GroupRemoveCommand_initOptions).call(this);
30
30
  __classPrivateFieldGet(this, _EntraM365GroupRemoveCommand_instances, "m", _EntraM365GroupRemoveCommand_initValidators).call(this);
31
+ __classPrivateFieldGet(this, _EntraM365GroupRemoveCommand_instances, "m", _EntraM365GroupRemoveCommand_initOptionSets).call(this);
32
+ __classPrivateFieldGet(this, _EntraM365GroupRemoveCommand_instances, "m", _EntraM365GroupRemoveCommand_initTypes).call(this);
31
33
  }
32
34
  async commandAction(logger, args) {
33
35
  const removeGroup = async () => {
34
36
  if (this.verbose) {
35
- await logger.logToStderr(`Removing Microsoft 365 Group: ${args.options.id}...`);
37
+ await logger.logToStderr(`Removing Microsoft 365 Group: ${args.options.id || args.options.displayName}...`);
36
38
  }
37
39
  try {
38
- const isUnifiedGroup = await entraGroup.isUnifiedGroup(args.options.id);
40
+ let groupId = args.options.id;
41
+ if (args.options.displayName) {
42
+ groupId = await entraGroup.getGroupIdByDisplayName(args.options.displayName);
43
+ }
44
+ const isUnifiedGroup = await entraGroup.isUnifiedGroup(groupId);
39
45
  if (!isUnifiedGroup) {
40
- throw Error(`Specified group with id '${args.options.id}' is not a Microsoft 365 group.`);
46
+ throw Error(`Specified group with id '${groupId}' is not a Microsoft 365 group.`);
41
47
  }
42
- const siteUrl = await this.getM365GroupSiteUrl(logger, args.options.id);
48
+ const siteUrl = await this.getM365GroupSiteUrl(logger, groupId);
43
49
  const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
44
50
  // Delete the Microsoft 365 group site. This operation will also delete the group.
45
51
  await this.deleteM365GroupSite(logger, siteUrl, spoAdminUrl);
46
52
  if (args.options.skipRecycleBin) {
47
- await this.deleteM365GroupFromRecycleBin(logger, args.options.id);
53
+ await this.deleteM365GroupFromRecycleBin(logger, groupId);
48
54
  await this.deleteSiteFromRecycleBin(logger, siteUrl, spoAdminUrl);
49
55
  }
50
56
  }
@@ -56,7 +62,7 @@ class EntraM365GroupRemoveCommand extends GraphCommand {
56
62
  await removeGroup();
57
63
  }
58
64
  else {
59
- const result = await cli.promptForConfirmation({ message: `Are you sure you want to remove the group ${args.options.id}?` });
65
+ const result = await cli.promptForConfirmation({ message: `Are you sure you want to remove the group ${args.options.id || args.options.displayName}?` });
60
66
  if (result) {
61
67
  await removeGroup();
62
68
  }
@@ -168,7 +174,9 @@ _EntraM365GroupRemoveCommand_instances = new WeakSet(), _EntraM365GroupRemoveCom
168
174
  });
169
175
  }, _EntraM365GroupRemoveCommand_initOptions = function _EntraM365GroupRemoveCommand_initOptions() {
170
176
  this.options.unshift({
171
- option: '-i, --id <id>'
177
+ option: '-i, --id [id]'
178
+ }, {
179
+ option: '-n, --displayName [displayName]'
172
180
  }, {
173
181
  option: '-f, --force'
174
182
  }, {
@@ -176,11 +184,15 @@ _EntraM365GroupRemoveCommand_instances = new WeakSet(), _EntraM365GroupRemoveCom
176
184
  });
177
185
  }, _EntraM365GroupRemoveCommand_initValidators = function _EntraM365GroupRemoveCommand_initValidators() {
178
186
  this.validators.push(async (args) => {
179
- if (!validation.isValidGuid(args.options.id)) {
187
+ if (args.options.id && !validation.isValidGuid(args.options.id)) {
180
188
  return `${args.options.id} is not a valid GUID`;
181
189
  }
182
190
  return true;
183
191
  });
192
+ }, _EntraM365GroupRemoveCommand_initOptionSets = function _EntraM365GroupRemoveCommand_initOptionSets() {
193
+ this.optionSets.push({ options: ['id', 'displayName'] });
194
+ }, _EntraM365GroupRemoveCommand_initTypes = function _EntraM365GroupRemoveCommand_initTypes() {
195
+ this.types.string.push('id', 'displayName');
184
196
  };
185
197
  EntraM365GroupRemoveCommand.maxRetries = 10;
186
198
  export default new EntraM365GroupRemoveCommand();