@pnp/cli-microsoft365 10.3.1 → 10.4.0-beta.1d1e5a7
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/config.js +1 -0
- 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/resourcenamespace/resourcenamespace-list.js +28 -0
- package/dist/m365/entra/commands/user/user-session-revoke.js +70 -0
- package/dist/m365/entra/commands.js +2 -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/dist/m365/spo/commands/page/clientsidepages.js +101 -9
- package/dist/m365/spo/commands/page/page-clientsidewebpart-add.js +2 -1
- package/dist/m365/spo/commands/page/page-get.js +40 -27
- package/dist/m365/spo/commands/page/page-text-add.js +7 -1
- package/dist/m365/tenant/commands/report/report-settings-get.js +32 -0
- package/dist/m365/tenant/commands.js +1 -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/resourcenamespace/resourcenamespace-list.mdx +96 -0
- package/docs/docs/cmd/entra/rolepermission/rolepermission-list.mdx +2 -0
- 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/docs/docs/cmd/spo/page/page-get.mdx +11 -2
- package/docs/docs/cmd/tenant/report/report-settings-get.mdx +67 -0
- package/npm-shrinkwrap.json +570 -1141
- package/package.json +14 -14
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 {
|
package/dist/config.js
CHANGED
|
@@ -38,6 +38,7 @@ export default {
|
|
|
38
38
|
'https://graph.microsoft.com/ReportSettings.ReadWrite.All',
|
|
39
39
|
'https://graph.microsoft.com/RoleAssignmentSchedule.ReadWrite.Directory',
|
|
40
40
|
'https://graph.microsoft.com/RoleEligibilitySchedule.Read.Directory',
|
|
41
|
+
'https://graph.microsoft.com/RoleManagement.Read.Directory',
|
|
41
42
|
'https://graph.microsoft.com/SecurityEvents.Read.All',
|
|
42
43
|
'https://graph.microsoft.com/ServiceHealth.Read.All',
|
|
43
44
|
'https://graph.microsoft.com/ServiceMessage.Read.All',
|
|
@@ -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,28 @@
|
|
|
1
|
+
import { odata } from '../../../../utils/odata.js';
|
|
2
|
+
import GraphCommand from '../../../base/GraphCommand.js';
|
|
3
|
+
import commands from '../../commands.js';
|
|
4
|
+
class EntraResourcenamespaceListCommand extends GraphCommand {
|
|
5
|
+
get name() {
|
|
6
|
+
return commands.RESOURCENAMESPACE_LIST;
|
|
7
|
+
}
|
|
8
|
+
get description() {
|
|
9
|
+
return 'Get a list of the RBAC resource namespaces and their properties';
|
|
10
|
+
}
|
|
11
|
+
defaultProperties() {
|
|
12
|
+
return ['id', 'name'];
|
|
13
|
+
}
|
|
14
|
+
async commandAction(logger) {
|
|
15
|
+
if (this.verbose) {
|
|
16
|
+
await logger.logToStderr('Getting a list of the RBAC resource namespaces and their properties...');
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
const results = await odata.getAllItems(`${this.resource}/beta/roleManagement/directory/resourceNamespaces`);
|
|
20
|
+
await logger.log(results);
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
this.handleRejectedODataJsonPromise(err);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export default new EntraResourcenamespaceListCommand();
|
|
28
|
+
//# sourceMappingURL=resourcenamespace-list.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
|
|
@@ -88,6 +88,7 @@ export default {
|
|
|
88
88
|
PIM_ROLE_ASSIGNMENT_ELIGIBILITY_LIST: `${prefix} pim role assignment eligibility list`,
|
|
89
89
|
PIM_ROLE_REQUEST_LIST: `${prefix} pim role request list`,
|
|
90
90
|
POLICY_LIST: `${prefix} policy list`,
|
|
91
|
+
RESOURCENAMESPACE_LIST: `${prefix} resourcenamespace list`,
|
|
91
92
|
ROLEDEFINITION_ADD: `${prefix} roledefinition add`,
|
|
92
93
|
ROLEDEFINITION_LIST: `${prefix} roledefinition list`,
|
|
93
94
|
ROLEDEFINITION_GET: `${prefix} roledefinition get`,
|
|
@@ -118,6 +119,7 @@ export default {
|
|
|
118
119
|
USER_REGISTRATIONDETAILS_LIST: `${prefix} user registrationdetails list`,
|
|
119
120
|
USER_REMOVE: `${prefix} user remove`,
|
|
120
121
|
USER_RECYCLEBINITEM_RESTORE: `${prefix} user recyclebinitem restore`,
|
|
122
|
+
USER_SESSION_REVOKE: `${prefix} user session revoke`,
|
|
121
123
|
USER_SET: `${prefix} user set`,
|
|
122
124
|
USER_SIGNIN_LIST: `${prefix} user signin list`
|
|
123
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" },
|