@pnp/cli-microsoft365 10.4.0-beta.791a39c → 10.4.0-beta.946980f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.cjs +3 -1
- package/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/cli/cli.js +10 -2
- package/dist/m365/entra/commands/group/group-member-add.js +12 -6
- package/dist/m365/entra/commands/group/group-member-set.js +12 -6
- package/dist/m365/entra/commands/user/user-session-revoke.js +70 -0
- package/dist/m365/entra/commands.js +1 -0
- package/dist/m365/outlook/commands/mailbox/mailbox-settings-get.js +71 -0
- package/dist/m365/outlook/commands/mailbox/mailbox-settings-set.js +5 -2
- package/dist/m365/outlook/commands.js +1 -0
- package/dist/m365/spo/commands/field/field-get.js +6 -3
- package/dist/m365/spo/commands/field/field-remove.js +10 -8
- package/dist/m365/spo/commands/field/field-set.js +6 -2
- package/dist/m365/spo/commands/mail/mail-send.js +2 -0
- package/docs/docs/cmd/entra/group/group-member-add.mdx +17 -2
- package/docs/docs/cmd/entra/group/group-member-set.mdx +17 -2
- package/docs/docs/cmd/entra/user/user-session-revoke.mdx +65 -0
- package/docs/docs/cmd/outlook/mailbox/mailbox-settings-get.mdx +131 -0
- package/docs/docs/cmd/spo/field/field-get.mdx +12 -2
- package/docs/docs/cmd/spo/field/field-remove.mdx +12 -3
- package/docs/docs/cmd/spo/field/field-set.mdx +17 -3
- package/npm-shrinkwrap.json +568 -1139
- package/package.json +13 -13
package/dist/cli/cli.js
CHANGED
|
@@ -159,9 +159,17 @@ async function execute(rawArgs) {
|
|
|
159
159
|
shouldPrompt) {
|
|
160
160
|
await cli.error('🌶️ Provide values for the following parameters:');
|
|
161
161
|
for (const error of result.error.errors) {
|
|
162
|
-
const
|
|
162
|
+
const optionName = error.path.join('.');
|
|
163
|
+
const optionInfo = cli.commandToExecute.options.find(o => o.name === optionName);
|
|
163
164
|
const answer = await cli.promptForValue(optionInfo);
|
|
164
|
-
|
|
165
|
+
// coerce the answer to the correct type
|
|
166
|
+
try {
|
|
167
|
+
const parsed = getCommandOptionsFromArgs([`--${optionName}`, answer], cli.commandToExecute);
|
|
168
|
+
cli.optionsFromArgs.options[optionName] = parsed[optionName];
|
|
169
|
+
}
|
|
170
|
+
catch (e) {
|
|
171
|
+
return cli.closeWithError(e.message, cli.optionsFromArgs, true);
|
|
172
|
+
}
|
|
165
173
|
}
|
|
166
174
|
}
|
|
167
175
|
else {
|
|
@@ -29,8 +29,11 @@ class EntraGroupMemberAddCommand extends GraphCommand {
|
|
|
29
29
|
}
|
|
30
30
|
async commandAction(logger, args) {
|
|
31
31
|
try {
|
|
32
|
+
if (args.options.groupDisplayName) {
|
|
33
|
+
await this.warn(logger, `Option 'groupDisplayName' is deprecated and will be removed in the next major release.`);
|
|
34
|
+
}
|
|
32
35
|
if (this.verbose) {
|
|
33
|
-
await logger.logToStderr(`Adding member(s) ${args.options.ids || args.options.userNames} to group ${args.options.groupId || args.options.groupDisplayName}...`);
|
|
36
|
+
await logger.logToStderr(`Adding member(s) ${args.options.ids || args.options.userNames} to group ${args.options.groupId || args.options.groupDisplayName || args.options.groupName}...`);
|
|
34
37
|
}
|
|
35
38
|
const groupId = await this.getGroupId(logger, args.options);
|
|
36
39
|
const userIds = await this.getUserIds(logger, args.options);
|
|
@@ -77,9 +80,9 @@ class EntraGroupMemberAddCommand extends GraphCommand {
|
|
|
77
80
|
return options.groupId;
|
|
78
81
|
}
|
|
79
82
|
if (this.verbose) {
|
|
80
|
-
await logger.logToStderr(`Retrieving ID of group ${options.groupDisplayName}...`);
|
|
83
|
+
await logger.logToStderr(`Retrieving ID of group ${options.groupDisplayName || options.groupName}...`);
|
|
81
84
|
}
|
|
82
|
-
return entraGroup.getGroupIdByDisplayName(options.groupDisplayName);
|
|
85
|
+
return entraGroup.getGroupIdByDisplayName(options.groupDisplayName || options.groupName);
|
|
83
86
|
}
|
|
84
87
|
async getUserIds(logger, options) {
|
|
85
88
|
if (options.ids) {
|
|
@@ -96,6 +99,7 @@ _EntraGroupMemberAddCommand_instances = new WeakSet(), _EntraGroupMemberAddComma
|
|
|
96
99
|
Object.assign(this.telemetryProperties, {
|
|
97
100
|
groupId: typeof args.options.groupId !== 'undefined',
|
|
98
101
|
groupDisplayName: typeof args.options.groupDisplayName !== 'undefined',
|
|
102
|
+
groupName: typeof args.options.groupName !== 'undefined',
|
|
99
103
|
ids: typeof args.options.ids !== 'undefined',
|
|
100
104
|
userNames: typeof args.options.userNames !== 'undefined'
|
|
101
105
|
});
|
|
@@ -104,7 +108,9 @@ _EntraGroupMemberAddCommand_instances = new WeakSet(), _EntraGroupMemberAddComma
|
|
|
104
108
|
this.options.unshift({
|
|
105
109
|
option: '-i, --groupId [groupId]'
|
|
106
110
|
}, {
|
|
107
|
-
option: '
|
|
111
|
+
option: '--groupDisplayName [groupDisplayName]'
|
|
112
|
+
}, {
|
|
113
|
+
option: '-n, --groupName [groupName]'
|
|
108
114
|
}, {
|
|
109
115
|
option: '--ids [ids]'
|
|
110
116
|
}, {
|
|
@@ -136,9 +142,9 @@ _EntraGroupMemberAddCommand_instances = new WeakSet(), _EntraGroupMemberAddComma
|
|
|
136
142
|
return true;
|
|
137
143
|
});
|
|
138
144
|
}, _EntraGroupMemberAddCommand_initOptionSets = function _EntraGroupMemberAddCommand_initOptionSets() {
|
|
139
|
-
this.optionSets.push({ options: ['groupId', 'groupDisplayName'] }, { options: ['ids', 'userNames'] });
|
|
145
|
+
this.optionSets.push({ options: ['groupId', 'groupDisplayName', 'groupName'] }, { options: ['ids', 'userNames'] });
|
|
140
146
|
}, _EntraGroupMemberAddCommand_initTypes = function _EntraGroupMemberAddCommand_initTypes() {
|
|
141
|
-
this.types.string.push('groupId', 'groupDisplayName', 'ids', 'userNames', 'role');
|
|
147
|
+
this.types.string.push('groupId', 'groupDisplayName', 'groupName', 'ids', 'userNames', 'role');
|
|
142
148
|
};
|
|
143
149
|
export default new EntraGroupMemberAddCommand();
|
|
144
150
|
//# sourceMappingURL=group-member-add.js.map
|
|
@@ -29,8 +29,11 @@ class EntraGroupMemberSetCommand extends GraphCommand {
|
|
|
29
29
|
}
|
|
30
30
|
async commandAction(logger, args) {
|
|
31
31
|
try {
|
|
32
|
+
if (args.options.groupDisplayName) {
|
|
33
|
+
await this.warn(logger, `Option 'groupDisplayName' is deprecated and will be removed in the next major release.`);
|
|
34
|
+
}
|
|
32
35
|
if (this.verbose) {
|
|
33
|
-
await logger.logToStderr(`Adding member(s) ${args.options.ids || args.options.userNames} to role ${args.options.role} of group ${args.options.groupId || args.options.groupDisplayName}...`);
|
|
36
|
+
await logger.logToStderr(`Adding member(s) ${args.options.ids || args.options.userNames} to role ${args.options.role} of group ${args.options.groupId || args.options.groupDisplayName || args.options.groupName}...`);
|
|
34
37
|
}
|
|
35
38
|
const groupId = await this.getGroupId(logger, args.options);
|
|
36
39
|
const userIds = await this.getUserIds(logger, args.options);
|
|
@@ -49,9 +52,9 @@ class EntraGroupMemberSetCommand extends GraphCommand {
|
|
|
49
52
|
return options.groupId;
|
|
50
53
|
}
|
|
51
54
|
if (this.verbose) {
|
|
52
|
-
await logger.logToStderr(`Retrieving ID of group ${options.groupDisplayName}...`);
|
|
55
|
+
await logger.logToStderr(`Retrieving ID of group ${options.groupDisplayName || options.groupName}...`);
|
|
53
56
|
}
|
|
54
|
-
return entraGroup.getGroupIdByDisplayName(options.groupDisplayName);
|
|
57
|
+
return entraGroup.getGroupIdByDisplayName(options.groupDisplayName || options.groupName);
|
|
55
58
|
}
|
|
56
59
|
async getUserIds(logger, options) {
|
|
57
60
|
if (options.ids) {
|
|
@@ -158,6 +161,7 @@ _EntraGroupMemberSetCommand_instances = new WeakSet(), _EntraGroupMemberSetComma
|
|
|
158
161
|
Object.assign(this.telemetryProperties, {
|
|
159
162
|
groupId: typeof args.options.groupId !== 'undefined',
|
|
160
163
|
groupDisplayName: typeof args.options.groupDisplayName !== 'undefined',
|
|
164
|
+
groupName: typeof args.options.groupName !== 'undefined',
|
|
161
165
|
ids: typeof args.options.ids !== 'undefined',
|
|
162
166
|
userNames: typeof args.options.userNames !== 'undefined'
|
|
163
167
|
});
|
|
@@ -166,7 +170,9 @@ _EntraGroupMemberSetCommand_instances = new WeakSet(), _EntraGroupMemberSetComma
|
|
|
166
170
|
this.options.unshift({
|
|
167
171
|
option: '-i, --groupId [groupId]'
|
|
168
172
|
}, {
|
|
169
|
-
option: '
|
|
173
|
+
option: '--groupDisplayName [groupDisplayName]'
|
|
174
|
+
}, {
|
|
175
|
+
option: '-n, --groupName [groupName]'
|
|
170
176
|
}, {
|
|
171
177
|
option: '--ids [ids]'
|
|
172
178
|
}, {
|
|
@@ -198,9 +204,9 @@ _EntraGroupMemberSetCommand_instances = new WeakSet(), _EntraGroupMemberSetComma
|
|
|
198
204
|
return true;
|
|
199
205
|
});
|
|
200
206
|
}, _EntraGroupMemberSetCommand_initOptionSets = function _EntraGroupMemberSetCommand_initOptionSets() {
|
|
201
|
-
this.optionSets.push({ options: ['groupId', 'groupDisplayName'] }, { options: ['ids', 'userNames'] });
|
|
207
|
+
this.optionSets.push({ options: ['groupId', 'groupDisplayName', 'groupName'] }, { options: ['ids', 'userNames'] });
|
|
202
208
|
}, _EntraGroupMemberSetCommand_initTypes = function _EntraGroupMemberSetCommand_initTypes() {
|
|
203
|
-
this.types.string.push('groupId', 'groupDisplayName', 'ids', 'userNames', 'role');
|
|
209
|
+
this.types.string.push('groupId', 'groupDisplayName', 'groupName', 'ids', 'userNames', 'role');
|
|
204
210
|
};
|
|
205
211
|
export default new EntraGroupMemberSetCommand();
|
|
206
212
|
//# sourceMappingURL=group-member-set.js.map
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
3
|
+
import { zod } from '../../../../utils/zod.js';
|
|
4
|
+
import GraphCommand from '../../../base/GraphCommand.js';
|
|
5
|
+
import commands from '../../commands.js';
|
|
6
|
+
import { validation } from '../../../../utils/validation.js';
|
|
7
|
+
import request from '../../../../request.js';
|
|
8
|
+
import { cli } from '../../../../cli/cli.js';
|
|
9
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
10
|
+
const options = globalOptionsZod
|
|
11
|
+
.extend({
|
|
12
|
+
userId: zod.alias('i', z.string().refine(id => validation.isValidGuid(id), id => ({
|
|
13
|
+
message: `'${id}' is not a valid GUID.`
|
|
14
|
+
})).optional()),
|
|
15
|
+
userName: zod.alias('n', z.string().refine(name => validation.isValidUserPrincipalName(name), name => ({
|
|
16
|
+
message: `'${name}' is not a valid UPN.`
|
|
17
|
+
})).optional()),
|
|
18
|
+
force: zod.alias('f', z.boolean().optional())
|
|
19
|
+
})
|
|
20
|
+
.strict();
|
|
21
|
+
class EntraUserSessionRevokeCommand extends GraphCommand {
|
|
22
|
+
get name() {
|
|
23
|
+
return commands.USER_SESSION_REVOKE;
|
|
24
|
+
}
|
|
25
|
+
get description() {
|
|
26
|
+
return 'Revokes all sign-in sessions for a given user';
|
|
27
|
+
}
|
|
28
|
+
get schema() {
|
|
29
|
+
return options;
|
|
30
|
+
}
|
|
31
|
+
getRefinedSchema(schema) {
|
|
32
|
+
return schema
|
|
33
|
+
.refine(options => [options.userId, options.userName].filter(o => o !== undefined).length === 1, {
|
|
34
|
+
message: `Specify either 'userId' or 'userName'.`
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
async commandAction(logger, args) {
|
|
38
|
+
const revokeUserSessions = async () => {
|
|
39
|
+
try {
|
|
40
|
+
const userIdentifier = args.options.userId ?? args.options.userName;
|
|
41
|
+
if (this.verbose) {
|
|
42
|
+
await logger.logToStderr(`Invalidating all the refresh tokens for user ${userIdentifier}...`);
|
|
43
|
+
}
|
|
44
|
+
const requestOptions = {
|
|
45
|
+
url: `${this.resource}/v1.0/users('${formatting.encodeQueryParameter(userIdentifier)}')/revokeSignInSessions`,
|
|
46
|
+
headers: {
|
|
47
|
+
accept: 'application/json;odata.metadata=none'
|
|
48
|
+
},
|
|
49
|
+
responseType: 'json',
|
|
50
|
+
data: {}
|
|
51
|
+
};
|
|
52
|
+
await request.post(requestOptions);
|
|
53
|
+
}
|
|
54
|
+
catch (err) {
|
|
55
|
+
this.handleRejectedODataJsonPromise(err);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
if (args.options.force) {
|
|
59
|
+
await revokeUserSessions();
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
const result = await cli.promptForConfirmation({ message: `This will revoke all sessions for the user '${args.options.userId || args.options.userName}', requiring the user to re-sign in from all devices. Are you sure?` });
|
|
63
|
+
if (result) {
|
|
64
|
+
await revokeUserSessions();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
export default new EntraUserSessionRevokeCommand();
|
|
70
|
+
//# sourceMappingURL=user-session-revoke.js.map
|
|
@@ -119,6 +119,7 @@ export default {
|
|
|
119
119
|
USER_REGISTRATIONDETAILS_LIST: `${prefix} user registrationdetails list`,
|
|
120
120
|
USER_REMOVE: `${prefix} user remove`,
|
|
121
121
|
USER_RECYCLEBINITEM_RESTORE: `${prefix} user recyclebinitem restore`,
|
|
122
|
+
USER_SESSION_REVOKE: `${prefix} user session revoke`,
|
|
122
123
|
USER_SET: `${prefix} user set`,
|
|
123
124
|
USER_SIGNIN_LIST: `${prefix} user signin list`
|
|
124
125
|
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
3
|
+
import { zod } from '../../../../utils/zod.js';
|
|
4
|
+
import GraphCommand from '../../../base/GraphCommand.js';
|
|
5
|
+
import commands from '../../commands.js';
|
|
6
|
+
import { validation } from '../../../../utils/validation.js';
|
|
7
|
+
import request from '../../../../request.js';
|
|
8
|
+
import { accessToken } from '../../../../utils/accessToken.js';
|
|
9
|
+
import auth from '../../../../Auth.js';
|
|
10
|
+
const options = globalOptionsZod
|
|
11
|
+
.extend({
|
|
12
|
+
userId: zod.alias('i', z.string().refine(id => validation.isValidGuid(id), id => ({
|
|
13
|
+
message: `'${id}' is not a valid GUID.`
|
|
14
|
+
})).optional()),
|
|
15
|
+
userName: zod.alias('n', z.string().refine(name => validation.isValidUserPrincipalName(name), name => ({
|
|
16
|
+
message: `'${name}' is not a valid UPN.`
|
|
17
|
+
})).optional())
|
|
18
|
+
})
|
|
19
|
+
.strict();
|
|
20
|
+
class OutlookMailboxSettingsGetCommand extends GraphCommand {
|
|
21
|
+
get name() {
|
|
22
|
+
return commands.MAILBOX_SETTINGS_GET;
|
|
23
|
+
}
|
|
24
|
+
get description() {
|
|
25
|
+
return `Get the user's mailbox settings`;
|
|
26
|
+
}
|
|
27
|
+
get schema() {
|
|
28
|
+
return options;
|
|
29
|
+
}
|
|
30
|
+
getRefinedSchema(schema) {
|
|
31
|
+
return schema
|
|
32
|
+
.refine(options => !(options.userId && options.userName), {
|
|
33
|
+
message: 'Specify either userId or userName, but not both'
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
async commandAction(logger, args) {
|
|
37
|
+
const isAppOnlyAccessToken = accessToken.isAppOnlyAccessToken(auth.connection.accessTokens[auth.defaultResource].accessToken);
|
|
38
|
+
let requestUrl = `${this.resource}/v1.0/me/mailboxSettings`;
|
|
39
|
+
if (isAppOnlyAccessToken) {
|
|
40
|
+
if (!args.options.userId && !args.options.userName) {
|
|
41
|
+
throw 'When running with application permissions either userId or userName is required';
|
|
42
|
+
}
|
|
43
|
+
const userIdentifier = args.options.userId ?? args.options.userName;
|
|
44
|
+
if (this.verbose) {
|
|
45
|
+
await logger.logToStderr(`Retrieving mailbox settings for user ${userIdentifier}...`);
|
|
46
|
+
}
|
|
47
|
+
requestUrl = `${this.resource}/v1.0/users('${userIdentifier}')/mailboxSettings`;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
if (args.options.userId || args.options.userName) {
|
|
51
|
+
throw 'You can retrieve mailbox settings of other users only if CLI is authenticated in app-only mode';
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const requestOptions = {
|
|
55
|
+
url: requestUrl,
|
|
56
|
+
headers: {
|
|
57
|
+
accept: 'application/json;odata.metadata=none'
|
|
58
|
+
},
|
|
59
|
+
responseType: 'json'
|
|
60
|
+
};
|
|
61
|
+
try {
|
|
62
|
+
const result = await request.get(requestOptions);
|
|
63
|
+
await logger.log(result);
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
this.handleRejectedODataJsonPromise(err);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
export default new OutlookMailboxSettingsGetCommand();
|
|
71
|
+
//# sourceMappingURL=mailbox-settings-get.js.map
|
|
@@ -46,6 +46,9 @@ class OutlookMailboxSettingsSetCommand extends GraphCommand {
|
|
|
46
46
|
}
|
|
47
47
|
getRefinedSchema(schema) {
|
|
48
48
|
return schema
|
|
49
|
+
.refine(options => !(options.userId && options.userName), {
|
|
50
|
+
message: 'Specify either userId or userName, but not both'
|
|
51
|
+
})
|
|
49
52
|
.refine(options => [options.workingDays, options.workingHoursStartTime, options.workingHoursEndTime, options.workingHoursTimeZone,
|
|
50
53
|
options.autoReplyStatus, options.autoReplyExternalAudience, options.autoReplyExternalMessage, options.autoReplyInternalMessage,
|
|
51
54
|
options.autoReplyStartDateTime, options.autoReplyStartTimeZone, options.autoReplyEndDateTime, options.autoReplyEndTimeZone,
|
|
@@ -57,8 +60,8 @@ class OutlookMailboxSettingsSetCommand extends GraphCommand {
|
|
|
57
60
|
const isAppOnlyAccessToken = accessToken.isAppOnlyAccessToken(auth.connection.accessTokens[auth.defaultResource].accessToken);
|
|
58
61
|
let requestUrl = `${this.resource}/v1.0/me/mailboxSettings`;
|
|
59
62
|
if (isAppOnlyAccessToken) {
|
|
60
|
-
if (args.options.userId && args.options.userName) {
|
|
61
|
-
throw 'When running with application permissions either userId or userName is required
|
|
63
|
+
if (!args.options.userId && !args.options.userName) {
|
|
64
|
+
throw 'When running with application permissions either userId or userName is required';
|
|
62
65
|
}
|
|
63
66
|
const userIdentifier = args.options.userId ?? args.options.userName;
|
|
64
67
|
if (this.verbose) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const prefix = 'outlook';
|
|
2
2
|
export default {
|
|
3
3
|
MAIL_SEND: `${prefix} mail send`,
|
|
4
|
+
MAILBOX_SETTINGS_GET: `${prefix} mailbox settings get`,
|
|
4
5
|
MAILBOX_SETTINGS_SET: `${prefix} mailbox settings set`,
|
|
5
6
|
MESSAGE_GET: `${prefix} message get`,
|
|
6
7
|
MESSAGE_LIST: `${prefix} message list`,
|
|
@@ -42,7 +42,7 @@ class SpoFieldGetCommand extends SpoCommand {
|
|
|
42
42
|
fieldRestUrl = `/getbyid('${formatting.encodeQueryParameter(args.options.id)}')`;
|
|
43
43
|
}
|
|
44
44
|
else {
|
|
45
|
-
fieldRestUrl = `/getbyinternalnameortitle('${formatting.encodeQueryParameter(args.options.title)}')`;
|
|
45
|
+
fieldRestUrl = `/getbyinternalnameortitle('${formatting.encodeQueryParameter((args.options.title || args.options.internalName))}')`;
|
|
46
46
|
}
|
|
47
47
|
const requestOptions = {
|
|
48
48
|
url: `${args.options.webUrl}/_api/web/${listRestUrl}fields${fieldRestUrl}`,
|
|
@@ -67,7 +67,8 @@ _SpoFieldGetCommand_instances = new WeakSet(), _SpoFieldGetCommand_initTelemetry
|
|
|
67
67
|
listTitle: typeof args.options.listTitle !== 'undefined',
|
|
68
68
|
listUrl: typeof args.options.listUrl !== 'undefined',
|
|
69
69
|
id: typeof args.options.id !== 'undefined',
|
|
70
|
-
title: typeof args.options.title !== 'undefined'
|
|
70
|
+
title: typeof args.options.title !== 'undefined',
|
|
71
|
+
internalName: typeof args.options.internalName !== 'undefined'
|
|
71
72
|
});
|
|
72
73
|
});
|
|
73
74
|
}, _SpoFieldGetCommand_initOptions = function _SpoFieldGetCommand_initOptions() {
|
|
@@ -83,6 +84,8 @@ _SpoFieldGetCommand_instances = new WeakSet(), _SpoFieldGetCommand_initTelemetry
|
|
|
83
84
|
option: '-i, --id [id]'
|
|
84
85
|
}, {
|
|
85
86
|
option: '-t, --title [title]'
|
|
87
|
+
}, {
|
|
88
|
+
option: '--internalName [internalName]'
|
|
86
89
|
});
|
|
87
90
|
}, _SpoFieldGetCommand_initValidators = function _SpoFieldGetCommand_initValidators() {
|
|
88
91
|
this.validators.push(async (args) => {
|
|
@@ -99,7 +102,7 @@ _SpoFieldGetCommand_instances = new WeakSet(), _SpoFieldGetCommand_initTelemetry
|
|
|
99
102
|
return true;
|
|
100
103
|
});
|
|
101
104
|
}, _SpoFieldGetCommand_initOptionSets = function _SpoFieldGetCommand_initOptionSets() {
|
|
102
|
-
this.optionSets.push({ options: ['id', 'title'] });
|
|
105
|
+
this.optionSets.push({ options: ['id', 'title', 'internalName'] });
|
|
103
106
|
};
|
|
104
107
|
export default new SpoFieldGetCommand();
|
|
105
108
|
//# sourceMappingURL=field-get.js.map
|
|
@@ -34,16 +34,16 @@ class SpoFieldRemoveCommand extends SpoCommand {
|
|
|
34
34
|
else {
|
|
35
35
|
messageEnd = `in site ${args.options.webUrl}`;
|
|
36
36
|
}
|
|
37
|
-
const removeField = async (listRestUrl, fieldId, title) => {
|
|
37
|
+
const removeField = async (listRestUrl, fieldId, title, internalName) => {
|
|
38
38
|
if (this.verbose) {
|
|
39
|
-
await logger.logToStderr(`Removing field ${fieldId || title} ${messageEnd}...`);
|
|
39
|
+
await logger.logToStderr(`Removing field ${fieldId || title || internalName} ${messageEnd}...`);
|
|
40
40
|
}
|
|
41
41
|
let fieldRestUrl = '';
|
|
42
42
|
if (fieldId) {
|
|
43
43
|
fieldRestUrl = `/getbyid('${formatting.encodeQueryParameter(fieldId)}')`;
|
|
44
44
|
}
|
|
45
45
|
else {
|
|
46
|
-
fieldRestUrl = `/getbyinternalnameortitle('${formatting.encodeQueryParameter(title)}')`;
|
|
46
|
+
fieldRestUrl = `/getbyinternalnameortitle('${formatting.encodeQueryParameter(title || internalName)}')`;
|
|
47
47
|
}
|
|
48
48
|
const requestOptions = {
|
|
49
49
|
url: `${args.options.webUrl}/_api/web/${listRestUrl}fields${fieldRestUrl}`,
|
|
@@ -88,7 +88,7 @@ class SpoFieldRemoveCommand extends SpoCommand {
|
|
|
88
88
|
}
|
|
89
89
|
const promises = [];
|
|
90
90
|
for (let index = 0; index < filteredResults.length; index++) {
|
|
91
|
-
promises.push(removeField(listRestUrl, filteredResults[index].Id
|
|
91
|
+
promises.push(removeField(listRestUrl, filteredResults[index].Id));
|
|
92
92
|
}
|
|
93
93
|
await Promise.all(promises);
|
|
94
94
|
}
|
|
@@ -98,8 +98,7 @@ class SpoFieldRemoveCommand extends SpoCommand {
|
|
|
98
98
|
}
|
|
99
99
|
else {
|
|
100
100
|
try {
|
|
101
|
-
await removeField(listRestUrl, args.options.id, args.options.title);
|
|
102
|
-
// REST post call doesn't return anything
|
|
101
|
+
await removeField(listRestUrl, args.options.id, args.options.title, args.options.internalName);
|
|
103
102
|
}
|
|
104
103
|
catch (err) {
|
|
105
104
|
this.handleRejectedODataJsonPromise(err);
|
|
@@ -110,7 +109,7 @@ class SpoFieldRemoveCommand extends SpoCommand {
|
|
|
110
109
|
await prepareRemoval();
|
|
111
110
|
}
|
|
112
111
|
else {
|
|
113
|
-
const confirmMessage = `Are you sure you want to remove the ${args.options.group ? 'fields' : 'field'} ${args.options.id || args.options.title || 'from group ' + args.options.group} ${messageEnd}?`;
|
|
112
|
+
const confirmMessage = `Are you sure you want to remove the ${args.options.group ? 'fields' : 'field'} ${args.options.id || args.options.title || args.options.internalName || 'from group ' + args.options.group} ${messageEnd}?`;
|
|
114
113
|
const result = await cli.promptForConfirmation({ message: confirmMessage });
|
|
115
114
|
if (result) {
|
|
116
115
|
await prepareRemoval();
|
|
@@ -127,6 +126,7 @@ _SpoFieldRemoveCommand_instances = new WeakSet(), _SpoFieldRemoveCommand_initTel
|
|
|
127
126
|
id: typeof args.options.id !== 'undefined',
|
|
128
127
|
group: typeof args.options.group !== 'undefined',
|
|
129
128
|
title: typeof args.options.title !== 'undefined',
|
|
129
|
+
internalName: typeof args.options.internalName !== 'undefined',
|
|
130
130
|
force: (!(!args.options.force)).toString()
|
|
131
131
|
});
|
|
132
132
|
});
|
|
@@ -143,6 +143,8 @@ _SpoFieldRemoveCommand_instances = new WeakSet(), _SpoFieldRemoveCommand_initTel
|
|
|
143
143
|
option: '-i, --id [id]'
|
|
144
144
|
}, {
|
|
145
145
|
option: '-t, --title [title]'
|
|
146
|
+
}, {
|
|
147
|
+
option: '--internalName [internalName]'
|
|
146
148
|
}, {
|
|
147
149
|
option: '-g, --group [group]'
|
|
148
150
|
}, {
|
|
@@ -163,7 +165,7 @@ _SpoFieldRemoveCommand_instances = new WeakSet(), _SpoFieldRemoveCommand_initTel
|
|
|
163
165
|
return true;
|
|
164
166
|
});
|
|
165
167
|
}, _SpoFieldRemoveCommand_initOptionSets = function _SpoFieldRemoveCommand_initOptionSets() {
|
|
166
|
-
this.optionSets.push({ options: ['id', 'title', 'group'] });
|
|
168
|
+
this.optionSets.push({ options: ['id', 'title', 'internalName', 'group'] });
|
|
167
169
|
};
|
|
168
170
|
export default new SpoFieldRemoveCommand();
|
|
169
171
|
//# sourceMappingURL=field-remove.js.map
|
|
@@ -66,7 +66,7 @@ class SpoFieldSetCommand extends SpoCommand {
|
|
|
66
66
|
// retrieve column CSOM object id
|
|
67
67
|
const fieldQuery = args.options.id ?
|
|
68
68
|
`<Method Id="663" ParentId="7" Name="GetById"><Parameters><Parameter Type="Guid">${formatting.escapeXml(args.options.id)}</Parameter></Parameters></Method>` :
|
|
69
|
-
`<Method Id="663" ParentId="7" Name="GetByInternalNameOrTitle"><Parameters><Parameter Type="String">${formatting.escapeXml(args.options.
|
|
69
|
+
`<Method Id="663" ParentId="7" Name="GetByInternalNameOrTitle"><Parameters><Parameter Type="String">${formatting.escapeXml(args.options.title || args.options.internalName)}</Parameter></Parameters></Method>`;
|
|
70
70
|
let requestOptions = {
|
|
71
71
|
url: `${args.options.webUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
72
72
|
headers: {
|
|
@@ -108,6 +108,7 @@ class SpoFieldSetCommand extends SpoCommand {
|
|
|
108
108
|
'listUrl',
|
|
109
109
|
'id',
|
|
110
110
|
'title',
|
|
111
|
+
'internalName',
|
|
111
112
|
'updateExistingLists',
|
|
112
113
|
'debug',
|
|
113
114
|
'verbose',
|
|
@@ -125,6 +126,7 @@ _SpoFieldSetCommand_instances = new WeakSet(), _SpoFieldSetCommand_initTelemetry
|
|
|
125
126
|
Object.assign(this.telemetryProperties, {
|
|
126
127
|
id: typeof args.options.id !== 'undefined',
|
|
127
128
|
title: typeof args.options.title !== 'undefined',
|
|
129
|
+
internalName: typeof args.options.internalName !== 'undefined',
|
|
128
130
|
listId: typeof args.options.listId !== 'undefined',
|
|
129
131
|
listTitle: typeof args.options.listTitle !== 'undefined',
|
|
130
132
|
listUrl: typeof args.options.listUrl !== 'undefined',
|
|
@@ -144,6 +146,8 @@ _SpoFieldSetCommand_instances = new WeakSet(), _SpoFieldSetCommand_initTelemetry
|
|
|
144
146
|
option: '-i, --id [id]'
|
|
145
147
|
}, {
|
|
146
148
|
option: '-t, --title [title]'
|
|
149
|
+
}, {
|
|
150
|
+
option: '--internalName [internalName]'
|
|
147
151
|
}, {
|
|
148
152
|
option: '--updateExistingLists'
|
|
149
153
|
});
|
|
@@ -168,7 +172,7 @@ _SpoFieldSetCommand_instances = new WeakSet(), _SpoFieldSetCommand_initTelemetry
|
|
|
168
172
|
return true;
|
|
169
173
|
});
|
|
170
174
|
}, _SpoFieldSetCommand_initOptionSets = function _SpoFieldSetCommand_initOptionSets() {
|
|
171
|
-
this.optionSets.push({ options: ['id', 'title'] });
|
|
175
|
+
this.optionSets.push({ options: ['id', 'title', 'internalName'] });
|
|
172
176
|
};
|
|
173
177
|
export default new SpoFieldSetCommand();
|
|
174
178
|
//# sourceMappingURL=field-set.js.map
|
|
@@ -8,6 +8,7 @@ import request from '../../../../request.js';
|
|
|
8
8
|
import { validation } from '../../../../utils/validation.js';
|
|
9
9
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
10
10
|
import commands from '../../commands.js';
|
|
11
|
+
import outlookCommands from '../../../outlook/commands.js';
|
|
11
12
|
class SpoMailSendCommand extends SpoCommand {
|
|
12
13
|
get name() {
|
|
13
14
|
return commands.MAIL_SEND;
|
|
@@ -23,6 +24,7 @@ class SpoMailSendCommand extends SpoCommand {
|
|
|
23
24
|
__classPrivateFieldGet(this, _SpoMailSendCommand_instances, "m", _SpoMailSendCommand_initValidators).call(this);
|
|
24
25
|
}
|
|
25
26
|
async commandAction(logger, args) {
|
|
27
|
+
await this.showDeprecationWarning(logger, commands.MAIL_SEND, outlookCommands.MAIL_SEND);
|
|
26
28
|
const params = {
|
|
27
29
|
properties: {
|
|
28
30
|
__metadata: { "type": "SP.Utilities.EmailProperties" },
|
|
@@ -14,10 +14,13 @@ m365 entra group member add [options]
|
|
|
14
14
|
|
|
15
15
|
```md definition-list
|
|
16
16
|
`-i, --groupId [groupId]`
|
|
17
|
-
: The ID of the Microsoft Entra group. Specify `groupId` or `
|
|
17
|
+
: The ID of the Microsoft Entra group. Specify `groupId`, `groupDisplayName` or `groupName` but not multiple.
|
|
18
18
|
|
|
19
19
|
`-n, --groupDisplayName [groupDisplayName]`
|
|
20
|
-
: The display name of the Microsoft Entra group. Specify `groupId` or `
|
|
20
|
+
: (deprecated. Use option `groupName` instead) The display name of the Microsoft Entra group. Specify `groupId`, `groupDisplayName` or `groupName` but not multiple.
|
|
21
|
+
|
|
22
|
+
`--groupName [groupName]`
|
|
23
|
+
: The display name of the Microsoft Entra group. Specify `groupId`, `groupDisplayName` or `groupName` but not multiple.
|
|
21
24
|
|
|
22
25
|
`--ids [ids]`
|
|
23
26
|
: Microsoft Entra IDs of users. You can also pass a comma-separated list of IDs. Specify either `ids` or `userNames` but not both.
|
|
@@ -39,6 +42,12 @@ Add a single member specified by ID as a member to a group specified by display
|
|
|
39
42
|
m365 entra group member add --groupDisplayName Developers --ids 098b9f52-f48c-4401-819f-29c33794c3f5 --role Member
|
|
40
43
|
```
|
|
41
44
|
|
|
45
|
+
Add a single member specified by ID as a member to a group specified by group name.
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
m365 entra group member add --groupName Developers --ids 098b9f52-f48c-4401-819f-29c33794c3f5 --role Member
|
|
49
|
+
```
|
|
50
|
+
|
|
42
51
|
Add multiple members specified by ID as members to a group specified by ID.
|
|
43
52
|
|
|
44
53
|
```sh
|
|
@@ -51,6 +60,12 @@ Add a single member specified by UPN as an owner to a group specified by display
|
|
|
51
60
|
m365 entra group member add --groupDisplayName Developers --userNames john.doe@contoso.com --role Owner
|
|
52
61
|
```
|
|
53
62
|
|
|
63
|
+
Add a single member specified by UPN as an owner to a group specified by group name.
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
m365 entra group member add --groupName Developers --userNames john.doe@contoso.com --role Owner
|
|
67
|
+
```
|
|
68
|
+
|
|
54
69
|
Adds multiple members specified by UPN as owners to a group specified by ID.
|
|
55
70
|
|
|
56
71
|
```sh
|
|
@@ -14,10 +14,13 @@ m365 entra group member set [options]
|
|
|
14
14
|
|
|
15
15
|
```md definition-list
|
|
16
16
|
`-i, --groupId [groupId]`
|
|
17
|
-
: The ID of the Entra ID group. Specify `groupId` or `
|
|
17
|
+
: The ID of the Entra ID group. Specify `groupId`, `groupDisplayName` or `groupName` but not multiple.
|
|
18
18
|
|
|
19
19
|
`-n, --groupDisplayName [groupDisplayName]`
|
|
20
|
-
: The display name of the Entra ID group. Specify `groupId` or `
|
|
20
|
+
: (deprecated. Use option `groupName` instead) The display name of the Entra ID group. Specify `groupId`, `groupDisplayName` or `groupName` but not multiple.
|
|
21
|
+
|
|
22
|
+
`--groupName [groupName]`
|
|
23
|
+
: The display name of the Microsoft Entra group. Specify `groupId`, `groupDisplayName` or `groupName` but not multiple.
|
|
21
24
|
|
|
22
25
|
`--ids [ids]`
|
|
23
26
|
: Comma-separated list of user IDs. Specify either `ids` or `userNames` but not both.
|
|
@@ -39,6 +42,12 @@ Update a single member specified by ID to a member of a group specified by displ
|
|
|
39
42
|
m365 entra group member set --groupDisplayName Developers --ids 098b9f52-f48c-4401-819f-29c33794c3f5 --role Member
|
|
40
43
|
```
|
|
41
44
|
|
|
45
|
+
Update a single member specified by ID to a member of a group specified by group name
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
m365 entra group member set --groupName Developers --ids 098b9f52-f48c-4401-819f-29c33794c3f5 --role Member
|
|
49
|
+
```
|
|
50
|
+
|
|
42
51
|
Update multiple members specified by ID to members of a group specified by ID
|
|
43
52
|
|
|
44
53
|
```sh
|
|
@@ -51,6 +60,12 @@ Update a single member specified by UPN to an owner of a group specified by disp
|
|
|
51
60
|
m365 entra group member set --groupDisplayName Developers --userNames john.doe@contoso.com --role Owner
|
|
52
61
|
```
|
|
53
62
|
|
|
63
|
+
Update a single member specified by UPN to an owner of a group specified by group name
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
m365 entra group member set --groupName Developers --userNames john.doe@contoso.com --role Owner
|
|
67
|
+
```
|
|
68
|
+
|
|
54
69
|
Update multiple members specified by UPN to owners of a group specified by ID
|
|
55
70
|
|
|
56
71
|
```sh
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import Global from '/docs/cmd/_global.mdx';
|
|
2
|
+
|
|
3
|
+
# entra user session revoke
|
|
4
|
+
|
|
5
|
+
Revokes all sign-in sessions for a given user
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
m365 entra user session revoke [options]
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Options
|
|
14
|
+
```md definition-list
|
|
15
|
+
`-i, --userId [userId]`
|
|
16
|
+
: The id of the user. Specify either `userId` or `userName`, but not both.
|
|
17
|
+
|
|
18
|
+
`-n, --userName [userName]`
|
|
19
|
+
: The user principal name of the user. Specify either `userId` or `userName`, but not both.
|
|
20
|
+
|
|
21
|
+
`-f, --force`
|
|
22
|
+
: Don't prompt for confirmation.
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
<Global />
|
|
26
|
+
|
|
27
|
+
## Remarks
|
|
28
|
+
|
|
29
|
+
:::info
|
|
30
|
+
|
|
31
|
+
To use this command you must be either **User Administrator** or **Global Administrator**.
|
|
32
|
+
|
|
33
|
+
:::
|
|
34
|
+
|
|
35
|
+
:::note
|
|
36
|
+
|
|
37
|
+
There might be a small delay of a few minutes before tokens are revoked.
|
|
38
|
+
|
|
39
|
+
This API doesn't revoke sign-in sessions for external users, because external users sign in through their home tenant.
|
|
40
|
+
|
|
41
|
+
:::
|
|
42
|
+
|
|
43
|
+
## Examples
|
|
44
|
+
|
|
45
|
+
Revoke sign-in sessions of a user specified by id
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
m365 entra user session revoke --userId 4fb72b9b-d0b0-4a35-8bc1-83f9a6488c48
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Revoke sign-in sessions of a user specified by its UPN
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
m365 entra user session revoke --userName john.doe@contoso.onmicrosoft.com
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Revoke sign-in sessions of a user specified by its UPN without prompting for confirmation
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
m365 entra user session revoke --userName john.doe@contoso.onmicrosoft.com --force
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Response
|
|
64
|
+
|
|
65
|
+
The command won't return a response on success.
|