@pnp/cli-microsoft365 11.7.0-beta.293104a → 11.7.0-beta.71e4ac5

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.
@@ -5,7 +5,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
5
5
  };
6
6
  var _EntraUserLicenseAddCommand_instances, _EntraUserLicenseAddCommand_initTelemetry, _EntraUserLicenseAddCommand_initOptions, _EntraUserLicenseAddCommand_initValidators, _EntraUserLicenseAddCommand_initOptionSets;
7
7
  import request from '../../../../request.js';
8
- import { formatting } from '../../../../utils/formatting.js';
9
8
  import { validation } from '../../../../utils/validation.js';
10
9
  import GraphCommand from '../../../base/GraphCommand.js';
11
10
  import commands from '../../commands.js';
@@ -28,7 +27,7 @@ class EntraUserLicenseAddCommand extends GraphCommand {
28
27
  const addLicenses = args.options.ids.split(',').map(x => { return { "disabledPlans": [], "skuId": x }; });
29
28
  const requestBody = { "addLicenses": addLicenses, "removeLicenses": [] };
30
29
  const requestOptions = {
31
- url: `${this.resource}/v1.0/users/${formatting.encodeQueryParameter(args.options.userId || args.options.userName)}/assignLicense`,
30
+ url: `${this.resource}/v1.0/users/${args.options.userId || args.options.userName}/assignLicense`,
32
31
  headers: {
33
32
  accept: 'application/json;odata.metadata=none'
34
33
  },
@@ -4,12 +4,13 @@ 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 _EntraUserLicenseListCommand_instances, _EntraUserLicenseListCommand_initTelemetry, _EntraUserLicenseListCommand_initOptions, _EntraUserLicenseListCommand_initValidators, _EntraUserLicenseListCommand_initOptionSets;
7
+ import { accessToken } from '../../../../utils/accessToken.js';
7
8
  import { odata } from '../../../../utils/odata.js';
8
- import { formatting } from '../../../../utils/formatting.js';
9
9
  import { validation } from '../../../../utils/validation.js';
10
+ import GraphCommand from '../../../base/GraphCommand.js';
10
11
  import commands from '../../commands.js';
11
- import GraphDelegatedCommand from '../../../base/GraphDelegatedCommand.js';
12
- class EntraUserLicenseListCommand extends GraphDelegatedCommand {
12
+ import auth from '../../../../Auth.js';
13
+ class EntraUserLicenseListCommand extends GraphCommand {
13
14
  get name() {
14
15
  return commands.USER_LICENSE_LIST;
15
16
  }
@@ -28,12 +29,16 @@ class EntraUserLicenseListCommand extends GraphDelegatedCommand {
28
29
  __classPrivateFieldGet(this, _EntraUserLicenseListCommand_instances, "m", _EntraUserLicenseListCommand_initOptionSets).call(this);
29
30
  }
30
31
  async commandAction(logger, args) {
32
+ const isAppOnlyAccessToken = accessToken.isAppOnlyAccessToken(auth.connection.accessTokens[this.resource].accessToken);
33
+ if (isAppOnlyAccessToken && !args.options.userId && !args.options.userName) {
34
+ this.handleError(`Specify at least 'userId' or 'userName' when using application permissions.`);
35
+ }
31
36
  if (this.verbose) {
32
37
  await logger.logToStderr(`Retrieving licenses from user: ${args.options.userId || args.options.userName || 'current user'}.`);
33
38
  }
34
39
  let requestUrl = `${this.resource}/v1.0/`;
35
40
  if (args.options.userId || args.options.userName) {
36
- requestUrl += `users/${formatting.encodeQueryParameter(args.options.userId || args.options.userName)}`;
41
+ requestUrl += `users/${args.options.userId || args.options.userName}`;
37
42
  }
38
43
  else {
39
44
  requestUrl += 'me';
@@ -7,7 +7,6 @@ var _EntraUserLicenseRemoveCommand_instances, _EntraUserLicenseRemoveCommand_ini
7
7
  import commands from '../../commands.js';
8
8
  import request from '../../../../request.js';
9
9
  import { validation } from '../../../../utils/validation.js';
10
- import { formatting } from '../../../../utils/formatting.js';
11
10
  import { cli } from '../../../../cli/cli.js';
12
11
  import GraphCommand from '../../../base/GraphCommand.js';
13
12
  class EntraUserLicenseRemoveCommand extends GraphCommand {
@@ -43,7 +42,7 @@ class EntraUserLicenseRemoveCommand extends GraphCommand {
43
42
  const removeLicenses = args.options.ids.split(',');
44
43
  const requestBody = { "addLicenses": [], "removeLicenses": removeLicenses };
45
44
  const requestOptions = {
46
- url: `${this.resource}/v1.0/users/${formatting.encodeQueryParameter(args.options.userId || args.options.userName)}/assignLicense`,
45
+ url: `${this.resource}/v1.0/users/${args.options.userId || args.options.userName}/assignLicense`,
47
46
  headers: {
48
47
  accept: 'application/json;odata.metadata=none'
49
48
  },
@@ -4,9 +4,7 @@ export default {
4
4
  CALENDAR_GET: `${prefix} calendar get`,
5
5
  CALENDAR_REMOVE: `${prefix} calendar remove`,
6
6
  CALENDARGROUP_LIST: `${prefix} calendargroup list`,
7
- EVENT_CANCEL: `${prefix} event cancel`,
8
7
  EVENT_LIST: `${prefix} event list`,
9
- EVENT_REMOVE: `${prefix} event remove`,
10
8
  MAIL_SEARCHFOLDER_ADD: `${prefix} mail searchfolder add`,
11
9
  MAIL_SEND: `${prefix} mail send`,
12
10
  MAILBOX_SETTINGS_GET: `${prefix} mailbox settings get`,
@@ -11,24 +11,9 @@ export const options = z.strictObject({
11
11
  error: e => `'${e.input}' is not a valid value for option chatId.`
12
12
  })
13
13
  .alias('i'),
14
- createdEndDateTime: z.string()
15
- .refine(time => validation.isValidISODateTime(time), {
16
- error: e => `'${e.input}' is not a valid ISO date-time string for option createdEndDateTime.`
17
- })
18
- .optional(),
19
14
  endDateTime: z.string()
20
15
  .refine(time => validation.isValidISODateTime(time), {
21
16
  error: e => `'${e.input}' is not a valid ISO date-time string for option endDateTime.`
22
- })
23
- .optional(),
24
- modifiedStartDateTime: z.string()
25
- .refine(time => validation.isValidISODateTime(time), {
26
- error: e => `'${e.input}' is not a valid ISO date-time string for option modifiedStartDateTime.`
27
- })
28
- .optional(),
29
- modifiedEndDateTime: z.string()
30
- .refine(time => validation.isValidISODateTime(time), {
31
- error: e => `'${e.input}' is not a valid ISO date-time string for option modifiedEndDateTime.`
32
17
  })
33
18
  .optional()
34
19
  });
@@ -45,37 +30,13 @@ class TeamsChatMessageListCommand extends GraphCommand {
45
30
  get schema() {
46
31
  return options;
47
32
  }
48
- getRefinedSchema(schema) {
49
- return schema
50
- .refine(options => !(options.endDateTime && options.createdEndDateTime), {
51
- error: 'Specify either endDateTime or createdEndDateTime, but not both.'
52
- })
53
- .refine(options => !(options.createdEndDateTime && (options.modifiedStartDateTime || options.modifiedEndDateTime)), {
54
- error: 'You cannot combine createdEndDateTime with modifiedStartDateTime or modifiedEndDateTime. These filters operate on different properties.'
55
- })
56
- .refine(options => !(options.endDateTime && (options.modifiedStartDateTime || options.modifiedEndDateTime)), {
57
- error: 'You cannot combine endDateTime with modifiedStartDateTime or modifiedEndDateTime. These filters operate on different properties.'
58
- });
59
- }
60
33
  async commandAction(logger, args) {
61
- if (args.options.endDateTime) {
62
- await this.warn(logger, `Option 'endDateTime' is deprecated. Please use 'createdEndDateTime' instead.`);
63
- args.options.createdEndDateTime = args.options.endDateTime;
64
- }
65
34
  try {
66
35
  let apiUrl = `${this.resource}/v1.0/chats/${args.options.chatId}/messages`;
67
- if (args.options.createdEndDateTime) {
68
- apiUrl += `?$filter=createdDateTime lt ${args.options.createdEndDateTime}&$orderby=createdDateTime desc`;
69
- }
70
- else if (args.options.modifiedStartDateTime || args.options.modifiedEndDateTime) {
71
- const filters = [];
72
- if (args.options.modifiedStartDateTime) {
73
- filters.push(`lastModifiedDateTime gt ${args.options.modifiedStartDateTime}`);
74
- }
75
- if (args.options.modifiedEndDateTime) {
76
- filters.push(`lastModifiedDateTime lt ${args.options.modifiedEndDateTime}`);
77
- }
78
- apiUrl += `?$filter=${filters.join(' and ')}&$orderby=lastModifiedDateTime desc`;
36
+ if (args.options.endDateTime) {
37
+ // You can only filter results if the request URL contains the $orderby and $filter query parameters configured for the same property;
38
+ // otherwise, the $filter query option is ignored.
39
+ apiUrl += `?$filter=createdDateTime lt ${args.options.endDateTime}&$orderby=createdDateTime desc`;
79
40
  }
80
41
  const items = await odata.getAllItems(apiUrl);
81
42
  if (args.options.output && args.options.output !== 'json') {
@@ -336,15 +336,8 @@ export const entraApp = {
336
336
  },
337
337
  responseType: 'json'
338
338
  };
339
- try {
340
- return await request.get(requestOptions);
341
- }
342
- catch (error) {
343
- if (error?.response?.status === 404) {
344
- throw Error(`App with objectId '${objectId}' not found in Microsoft Entra ID.`);
345
- }
346
- throw error;
347
- }
339
+ const app = await request.get(requestOptions);
340
+ return app;
348
341
  }
349
342
  };
350
343
  //# sourceMappingURL=entraApp.js.map
@@ -16,25 +16,6 @@ m365 entra license list [options]
16
16
 
17
17
  <Global />
18
18
 
19
- ## Permissions
20
-
21
- <Tabs>
22
- <TabItem value="Delegated">
23
-
24
- | Resource | Permissions |
25
- |-----------------|----------------------------|
26
- | Microsoft Graph | LicenseAssignment.Read.All |
27
-
28
- </TabItem>
29
- <TabItem value="Application">
30
-
31
- | Resource | Permissions |
32
- |-----------------|----------------------------|
33
- | Microsoft Graph | LicenseAssignment.Read.All |
34
-
35
- </TabItem>
36
- </Tabs>
37
-
38
19
  ## Examples
39
20
 
40
21
  List all licenses within the tenant.
@@ -24,25 +24,6 @@ m365 entra m365group conversation list [options]
24
24
 
25
25
  <Global />
26
26
 
27
- ## Permissions
28
-
29
- <Tabs>
30
- <TabItem value="Delegated">
31
-
32
- | Resource | Permissions |
33
- |-----------------|-----------------------------|
34
- | Microsoft Graph | Group-Conversation.Read.All |
35
-
36
- </TabItem>
37
- <TabItem value="Application">
38
-
39
- | Resource | Permissions |
40
- |-----------------|-----------------------------|
41
- | Microsoft Graph | Group-Conversation.Read.All |
42
-
43
- </TabItem>
44
- </Tabs>
45
-
46
27
  ## Examples
47
28
 
48
29
  Lists conversations for the Microsoft 365 group specified by id.
@@ -27,25 +27,6 @@ m365 entra m365group conversation post list [options]
27
27
 
28
28
  <Global />
29
29
 
30
- ## Permissions
31
-
32
- <Tabs>
33
- <TabItem value="Delegated">
34
-
35
- | Resource | Permissions |
36
- |-----------------|-----------------------------|
37
- | Microsoft Graph | Group-Conversation.Read.All |
38
-
39
- </TabItem>
40
- <TabItem value="Application">
41
-
42
- | Resource | Permissions |
43
- |-----------------|-----------------------------|
44
- | Microsoft Graph | Group-Conversation.Read.All |
45
-
46
- </TabItem>
47
- </Tabs>
48
-
49
30
  ## Examples
50
31
 
51
32
  Lists the posts of the specific conversation of Microsoft 365 group by groupId
@@ -35,25 +35,6 @@ The user must have a `usageLocation` value in order to assign a license to it.
35
35
 
36
36
  :::
37
37
 
38
- ## Permissions
39
-
40
- <Tabs>
41
- <TabItem value="Delegated">
42
-
43
- | Resource | Permissions |
44
- |-----------------|---------------------------------|
45
- | Microsoft Graph | LicenseAssignment.ReadWrite.All |
46
-
47
- </TabItem>
48
- <TabItem value="Application">
49
-
50
- | Resource | Permissions |
51
- |-----------------|---------------------------------|
52
- | Microsoft Graph | LicenseAssignment.ReadWrite.All |
53
-
54
- </TabItem>
55
- </Tabs>
56
-
57
38
  ## Examples
58
39
 
59
40
  Assign specific licenses to a specific user by UPN.
@@ -28,27 +28,10 @@ m365 entra user license list [options]
28
28
 
29
29
  :::tip
30
30
 
31
- If you don't specify any option, the command will list the license details of the current logged in user.
31
+ If you don't specify any option, the command will list the license details of the current logged in user. This does not work when using application permissions.
32
32
 
33
33
  :::
34
34
 
35
- ## Permissions
36
-
37
- <Tabs>
38
- <TabItem value="Delegated">
39
-
40
- | Resource | Permissions |
41
- |-----------------|----------------------------|
42
- | Microsoft Graph | LicenseAssignment.Read.All |
43
-
44
- </TabItem>
45
- <TabItem value="Application">
46
-
47
- This command does not support application permissions.
48
-
49
- </TabItem>
50
- </Tabs>
51
-
52
35
  ## Examples
53
36
 
54
37
  List license details of the current logged in user.
@@ -1,6 +1,4 @@
1
1
  import Global from '../../_global.mdx';
2
- import Tabs from '@theme/Tabs';
3
- import TabItem from '@theme/TabItem';
4
2
 
5
3
  # entra user license remove
6
4
 
@@ -30,25 +28,6 @@ m365 entra user license remove [options]
30
28
 
31
29
  <Global />
32
30
 
33
- ## Permissions
34
-
35
- <Tabs>
36
- <TabItem value="Delegated">
37
-
38
- | Resource | Permissions |
39
- |-----------------|---------------------------------|
40
- | Microsoft Graph | LicenseAssignment.ReadWrite.All |
41
-
42
- </TabItem>
43
- <TabItem value="Application">
44
-
45
- | Resource | Permissions |
46
- |-----------------|---------------------------------|
47
- | Microsoft Graph | LicenseAssignment.ReadWrite.All |
48
-
49
- </TabItem>
50
- </Tabs>
51
-
52
31
  ## Examples
53
32
 
54
33
  Remove specific licenses from a specific user by UPN.
@@ -18,17 +18,8 @@ m365 teams chat message list [options]
18
18
  `-i, --chatId <chatId>`
19
19
  : The ID of the chat conversation.
20
20
 
21
- `--createdEndDateTime [createdEndDateTime]`
22
- : Time indicating the exclusive end of a time range when the message was created.
23
-
24
21
  `--endDateTime [endDateTime]`
25
- : (deprecated. Use `createdEndDateTime` instead) Time indicating the exclusive end of a time range when the message was created.
26
-
27
- `--modifiedStartDateTime [modifiedStartDateTime]`
28
- : Time indicating the inclusive start of a time range when the message was last modified. Cannot be combined with `createdEndDateTime`.
29
-
30
- `--modifiedEndDateTime [modifiedEndDateTime]`
31
- : Time indicating the exclusive end of a time range when the message was last modified. Cannot be combined with `createdEndDateTime`.
22
+ : Time indicating the exclusive end of a time range when the message was created.
32
23
  ```
33
24
 
34
25
  <Global />
@@ -63,19 +54,7 @@ m365 teams chat message list --chatId 19:2da4c29f6d7041eca70b638b43d45437@thread
63
54
  List messages from a Microsoft Teams chat conversation created before November 1, 2022
64
55
 
65
56
  ```sh
66
- m365 teams chat message list --chatId 19:2da4c29f6d7041eca70b638b43d45437@thread.v2 --createdEndDateTime 2022-11-01T00:00:00Z
67
- ```
68
-
69
- List messages from a Microsoft Teams chat conversation modified after October 1, 2025
70
-
71
- ```sh
72
- m365 teams chat message list --chatId 19:2da4c29f6d7041eca70b638b43d45437@thread.v2 --modifiedStartDateTime 2025-10-01T00:00:00Z
73
- ```
74
-
75
- List messages from a Microsoft Teams chat conversation modified between October 1, 2025 and November 1, 2025
76
-
77
- ```sh
78
- m365 teams chat message list --chatId 19:2da4c29f6d7041eca70b638b43d45437@thread.v2 --modifiedStartDateTime 2025-10-01T00:00:00Z --modifiedEndDateTime 2025-11-01T00:00:00Z
57
+ m365 teams chat message list --chatId 19:2da4c29f6d7041eca70b638b43d45437@thread.v2 --endDateTime 2022-11-01T00:00:00Z
79
58
  ```
80
59
 
81
60
  ## Response
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnp/cli-microsoft365",
3
- "version": "11.7.0-beta.293104a",
3
+ "version": "11.7.0-beta.71e4ac5",
4
4
  "description": "Manage Microsoft 365 and SharePoint Framework projects on any platform",
5
5
  "license": "MIT",
6
6
  "main": "./dist/api.js",
@@ -1,103 +0,0 @@
1
- import auth from '../../../../Auth.js';
2
- import request from '../../../../request.js';
3
- import { accessToken } from '../../../../utils/accessToken.js';
4
- import { validation } from '../../../../utils/validation.js';
5
- import GraphCommand from '../../../base/GraphCommand.js';
6
- import commands from '../../commands.js';
7
- import { cli } from '../../../../cli/cli.js';
8
- import { globalOptionsZod } from '../../../../Command.js';
9
- import { z } from 'zod';
10
- export const options = z.strictObject({
11
- ...globalOptionsZod.shape,
12
- id: z.string().alias('i'),
13
- userId: z.string().refine(id => validation.isValidGuid(id), {
14
- error: e => `'${e.input}' is not a valid GUID.`
15
- }).optional(),
16
- userName: z.string()
17
- .refine(upn => validation.isValidUserPrincipalName(upn) === true, {
18
- error: e => `'${e.input}' is not a valid user principal name for option 'userName'.`
19
- })
20
- .optional(),
21
- comment: z.string().optional(),
22
- force: z.boolean().optional().alias('f')
23
- });
24
- class OutlookEventCancelCommand extends GraphCommand {
25
- get name() {
26
- return commands.EVENT_CANCEL;
27
- }
28
- get description() {
29
- return 'Cancels a calendar event';
30
- }
31
- get schema() {
32
- return options;
33
- }
34
- getRefinedSchema(schema) {
35
- return schema
36
- .refine(options => !(options.userId && options.userName), {
37
- error: `Specify either 'userId' or 'userName', but not both.`
38
- });
39
- }
40
- async commandAction(logger, args) {
41
- const isAppOnlyAccessToken = accessToken.isAppOnlyAccessToken(auth.connection.accessTokens[auth.defaultResource].accessToken);
42
- let principalUrl = '';
43
- const token = auth.connection.accessTokens[auth.defaultResource].accessToken;
44
- if (isAppOnlyAccessToken) {
45
- if (!args.options.userId && !args.options.userName) {
46
- throw `The option 'userId' or 'userName' is required when cancelling an event using application permissions.`;
47
- }
48
- }
49
- else {
50
- if (args.options.userId) {
51
- const currentUserId = accessToken.getUserIdFromAccessToken(token);
52
- if (args.options.userId !== currentUserId) {
53
- throw `You can only cancel your own events when using delegated permissions. The specified userId '${args.options.userId}' does not match the current user '${currentUserId}'.`;
54
- }
55
- }
56
- if (args.options.userName) {
57
- const currentUserName = accessToken.getUserNameFromAccessToken(token);
58
- if (args.options.userName.toLowerCase() !== currentUserName.toLowerCase()) {
59
- throw `You can only cancel your own events when using delegated permissions. The specified userName '${args.options.userName}' does not match the current user '${currentUserName}'.`;
60
- }
61
- }
62
- }
63
- if (args.options.userId || args.options.userName) {
64
- const userIdentifier = args.options.userId ?? args.options.userName;
65
- principalUrl += `users('${userIdentifier}')`;
66
- }
67
- else {
68
- principalUrl += 'me';
69
- }
70
- const cancelEvent = async () => {
71
- try {
72
- if (this.verbose) {
73
- await logger.logToStderr(`Cancelling event with id '${args.options.id}'...`);
74
- }
75
- const requestOptions = {
76
- url: `${this.resource}/v1.0/${principalUrl}/events/${args.options.id}/cancel`,
77
- headers: {
78
- accept: 'application/json;odata.metadata=none',
79
- 'content-type': 'application/json'
80
- },
81
- data: {
82
- comment: args.options.comment
83
- }
84
- };
85
- await request.post(requestOptions);
86
- }
87
- catch (err) {
88
- this.handleRejectedODataJsonPromise(err);
89
- }
90
- };
91
- if (args.options.force) {
92
- await cancelEvent();
93
- }
94
- else {
95
- const result = await cli.promptForConfirmation({ message: `Are you sure you want to cancel event with id '${args.options.id}'?` });
96
- if (result) {
97
- await cancelEvent();
98
- }
99
- }
100
- }
101
- }
102
- export default new OutlookEventCancelCommand();
103
- //# sourceMappingURL=event-cancel.js.map
@@ -1,104 +0,0 @@
1
- import auth from '../../../../Auth.js';
2
- import request from '../../../../request.js';
3
- import { accessToken } from '../../../../utils/accessToken.js';
4
- import { validation } from '../../../../utils/validation.js';
5
- import GraphCommand from '../../../base/GraphCommand.js';
6
- import commands from '../../commands.js';
7
- import { cli } from '../../../../cli/cli.js';
8
- import { globalOptionsZod } from '../../../../Command.js';
9
- import { z } from 'zod';
10
- export const options = z.strictObject({
11
- ...globalOptionsZod.shape,
12
- id: z.string().alias('i'),
13
- userId: z.string().refine(id => validation.isValidGuid(id), {
14
- error: e => `'${e.input}' is not a valid GUID.`
15
- }).optional(),
16
- userName: z.string()
17
- .refine(upn => validation.isValidUserPrincipalName(upn) === true, {
18
- error: e => `'${e.input}' is not a valid user principal name for option 'userName'.`
19
- })
20
- .optional(),
21
- permanent: z.boolean().optional(),
22
- force: z.boolean().optional().alias('f')
23
- });
24
- class OutlookEventRemoveCommand extends GraphCommand {
25
- get name() {
26
- return commands.EVENT_REMOVE;
27
- }
28
- get description() {
29
- return 'Removes an event from a calendar';
30
- }
31
- get schema() {
32
- return options;
33
- }
34
- getRefinedSchema(schema) {
35
- return schema.refine(options => !options.userId || !options.userName, {
36
- error: 'Specify either userId or userName, but not both.'
37
- });
38
- }
39
- async commandAction(logger, args) {
40
- const isAppOnlyAccessToken = accessToken.isAppOnlyAccessToken(auth.connection.accessTokens[auth.defaultResource].accessToken);
41
- const token = auth.connection.accessTokens[auth.defaultResource].accessToken;
42
- if (isAppOnlyAccessToken) {
43
- if (!args.options.userId && !args.options.userName) {
44
- throw `The option 'userId' or 'userName' is required when removing an event using application permissions.`;
45
- }
46
- }
47
- else {
48
- if (args.options.userId) {
49
- const currentUserId = accessToken.getUserIdFromAccessToken(token);
50
- if (args.options.userId !== currentUserId) {
51
- throw `You can only remove your own events when using delegated permissions. The specified userId '${args.options.userId}' does not match the current user '${currentUserId}'.`;
52
- }
53
- }
54
- if (args.options.userName) {
55
- const currentUserName = accessToken.getUserNameFromAccessToken(token);
56
- if (args.options.userName.toLowerCase() !== currentUserName.toLowerCase()) {
57
- throw `You can only remove your own events when using delegated permissions. The specified userName '${args.options.userName}' does not match the current user '${currentUserName}'.`;
58
- }
59
- }
60
- }
61
- let principalUrl = '';
62
- const userIdentifier = args.options.userId ?? args.options.userName;
63
- if (userIdentifier) {
64
- principalUrl += `users('${userIdentifier}')`;
65
- }
66
- else {
67
- principalUrl += 'me';
68
- }
69
- const removeEvent = async () => {
70
- try {
71
- if (this.verbose) {
72
- await logger.logToStderr(`Removing event with id '${args.options.id}'...`);
73
- }
74
- const requestOptions = {
75
- url: `${this.resource}/v1.0/${principalUrl}/events/${args.options.id}`,
76
- headers: {
77
- accept: 'application/json;odata.metadata=none'
78
- }
79
- };
80
- if (args.options.permanent) {
81
- requestOptions.url += '/permanentDelete';
82
- await request.post(requestOptions);
83
- }
84
- else {
85
- await request.delete(requestOptions);
86
- }
87
- }
88
- catch (err) {
89
- this.handleRejectedODataJsonPromise(err);
90
- }
91
- };
92
- if (args.options.force) {
93
- await removeEvent();
94
- }
95
- else {
96
- const result = await cli.promptForConfirmation({ message: `Are you sure you want to remove event with id '${args.options.id}'?` });
97
- if (result) {
98
- await removeEvent();
99
- }
100
- }
101
- }
102
- }
103
- export default new OutlookEventRemoveCommand();
104
- //# sourceMappingURL=event-remove.js.map