@pnp/cli-microsoft365 11.7.0-beta.293104a → 11.7.0-beta.71c58f3
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/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/m365/outlook/commands/calendargroup/calendargroup-set.js +115 -0
- package/dist/m365/outlook/commands.js +1 -0
- package/dist/m365/spfx/commands/SpfxCompatibilityMatrix.js +628 -0
- package/dist/m365/spfx/commands/project/DeployWorkflow.js +2 -2
- package/dist/m365/spfx/commands/project/project-azuredevops-pipeline-add.js +13 -1
- package/dist/m365/spfx/commands/project/project-github-workflow-add.js +16 -1
- package/dist/m365/spfx/commands/spfx-doctor.js +5 -631
- package/dist/utils/spfx.js +59 -0
- package/docs/docs/cmd/entra/user/user-groupmembership-list.mdx +19 -0
- package/docs/docs/cmd/entra/user/user-guest-add.mdx +19 -0
- package/docs/docs/cmd/entra/user/user-password-validate.mdx +12 -0
- package/docs/docs/cmd/entra/user/user-recyclebinitem-clear.mdx +21 -0
- package/docs/docs/cmd/entra/user/user-recyclebinitem-list.mdx +19 -0
- package/docs/docs/cmd/entra/user/user-recyclebinitem-remove.mdx +21 -0
- package/docs/docs/cmd/entra/user/user-recyclebinitem-restore.mdx +19 -0
- package/docs/docs/cmd/entra/user/user-registrationdetails-list.mdx +19 -0
- package/docs/docs/cmd/entra/user/user-session-revoke.mdx +21 -0
- package/docs/docs/cmd/entra/user/user-signin-list.mdx +19 -0
- package/docs/docs/cmd/exo/approleassignment/approleassignment-add.mdx +19 -0
- package/docs/docs/cmd/file/convert/convert-pdf.mdx +21 -0
- package/docs/docs/cmd/file/file-add.mdx +21 -0
- package/docs/docs/cmd/file/file-copy.mdx +21 -0
- package/docs/docs/cmd/file/file-list.mdx +19 -0
- package/docs/docs/cmd/file/file-move.mdx +21 -0
- package/docs/docs/cmd/outlook/calendargroup/calendargroup-set.mdx +83 -0
- package/package.json +2 -1
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
3
|
+
import GraphCommand from '../../../base/GraphCommand.js';
|
|
4
|
+
import commands from '../../commands.js';
|
|
5
|
+
import { validation } from '../../../../utils/validation.js';
|
|
6
|
+
import request from '../../../../request.js';
|
|
7
|
+
import { accessToken } from '../../../../utils/accessToken.js';
|
|
8
|
+
import auth from '../../../../Auth.js';
|
|
9
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
10
|
+
import { calendarGroup } from '../../../../utils/calendarGroup.js';
|
|
11
|
+
export const options = z.strictObject({
|
|
12
|
+
...globalOptionsZod.shape,
|
|
13
|
+
id: z.string().optional(),
|
|
14
|
+
name: z.string().optional(),
|
|
15
|
+
userId: z.string().refine(id => validation.isValidGuid(id), {
|
|
16
|
+
error: e => `'${e.input}' is not a valid GUID.`
|
|
17
|
+
}).optional(),
|
|
18
|
+
userName: z.string().refine(name => validation.isValidUserPrincipalName(name), {
|
|
19
|
+
error: e => `'${e.input}' is not a valid UPN.`
|
|
20
|
+
}).optional(),
|
|
21
|
+
newName: z.string()
|
|
22
|
+
});
|
|
23
|
+
class OutlookCalendarGroupSetCommand extends GraphCommand {
|
|
24
|
+
get name() {
|
|
25
|
+
return commands.CALENDARGROUP_SET;
|
|
26
|
+
}
|
|
27
|
+
get description() {
|
|
28
|
+
return 'Updates a calendar group for a user';
|
|
29
|
+
}
|
|
30
|
+
get schema() {
|
|
31
|
+
return options;
|
|
32
|
+
}
|
|
33
|
+
getRefinedSchema(schema) {
|
|
34
|
+
return schema
|
|
35
|
+
.refine(options => !(options.userId && options.userName), {
|
|
36
|
+
error: 'Specify either userId or userName, but not both.'
|
|
37
|
+
})
|
|
38
|
+
.refine(options => !(!options.id && !options.name), {
|
|
39
|
+
error: 'Specify either id or name.'
|
|
40
|
+
})
|
|
41
|
+
.refine(options => !(options.id && options.name), {
|
|
42
|
+
error: 'Specify either id or name, but not both.'
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
async commandAction(logger, args) {
|
|
46
|
+
try {
|
|
47
|
+
const token = auth.connection.accessTokens[auth.defaultResource].accessToken;
|
|
48
|
+
const isAppOnlyAccessToken = accessToken.isAppOnlyAccessToken(token);
|
|
49
|
+
let userUrl;
|
|
50
|
+
let graphUserId;
|
|
51
|
+
if (isAppOnlyAccessToken) {
|
|
52
|
+
if (!args.options.userId && !args.options.userName) {
|
|
53
|
+
throw 'When running with application permissions either userId or userName is required.';
|
|
54
|
+
}
|
|
55
|
+
graphUserId = (args.options.userId ?? args.options.userName);
|
|
56
|
+
userUrl = `${this.resource}/v1.0/users('${formatting.encodeQueryParameter(graphUserId)}')`;
|
|
57
|
+
if (this.verbose) {
|
|
58
|
+
await logger.logToStderr(`Updating calendar group using application permissions for user '${graphUserId}'...`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
else if (args.options.userId || args.options.userName) {
|
|
62
|
+
const currentUserId = accessToken.getUserIdFromAccessToken(token);
|
|
63
|
+
const currentUserName = accessToken.getUserNameFromAccessToken(token);
|
|
64
|
+
const isOtherUser = (args.options.userId && args.options.userId !== currentUserId) ||
|
|
65
|
+
(args.options.userName && args.options.userName.toLowerCase() !== currentUserName?.toLowerCase());
|
|
66
|
+
if (isOtherUser) {
|
|
67
|
+
const scopes = accessToken.getScopesFromAccessToken(token);
|
|
68
|
+
const hasSharedScope = scopes.some(s => s === 'Calendars.ReadWrite.Shared');
|
|
69
|
+
if (!hasSharedScope) {
|
|
70
|
+
throw `To update calendar groups of other users, the Entra ID application used for authentication must have the Calendars.ReadWrite.Shared delegated permission assigned.`;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
graphUserId = (args.options.userId ?? args.options.userName);
|
|
74
|
+
userUrl = `${this.resource}/v1.0/users('${formatting.encodeQueryParameter(graphUserId)}')`;
|
|
75
|
+
if (this.verbose) {
|
|
76
|
+
await logger.logToStderr(`Updating calendar group using delegated permissions for user '${graphUserId}'...`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
graphUserId = accessToken.getUserIdFromAccessToken(token);
|
|
81
|
+
userUrl = `${this.resource}/v1.0/me`;
|
|
82
|
+
if (this.verbose) {
|
|
83
|
+
await logger.logToStderr('Updating calendar group for the signed-in user...');
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
let calendarGroupId;
|
|
87
|
+
if (args.options.id) {
|
|
88
|
+
calendarGroupId = args.options.id;
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
const calendarGroupResult = await calendarGroup.getUserCalendarGroupByName(graphUserId, args.options.name);
|
|
92
|
+
calendarGroupId = calendarGroupResult.id;
|
|
93
|
+
}
|
|
94
|
+
if (this.verbose) {
|
|
95
|
+
await logger.logToStderr(`Updating calendar group '${calendarGroupId}'...`);
|
|
96
|
+
}
|
|
97
|
+
const requestOptions = {
|
|
98
|
+
url: `${userUrl}/calendarGroups/${calendarGroupId}`,
|
|
99
|
+
headers: {
|
|
100
|
+
accept: 'application/json;odata.metadata=none'
|
|
101
|
+
},
|
|
102
|
+
responseType: 'json',
|
|
103
|
+
data: {
|
|
104
|
+
name: args.options.newName
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
await request.patch(requestOptions);
|
|
108
|
+
}
|
|
109
|
+
catch (err) {
|
|
110
|
+
this.handleRejectedODataJsonPromise(err);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
export default new OutlookCalendarGroupSetCommand();
|
|
115
|
+
//# sourceMappingURL=calendargroup-set.js.map
|
|
@@ -4,6 +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
|
+
CALENDARGROUP_SET: `${prefix} calendargroup set`,
|
|
7
8
|
EVENT_CANCEL: `${prefix} event cancel`,
|
|
8
9
|
EVENT_LIST: `${prefix} event list`,
|
|
9
10
|
EVENT_REMOVE: `${prefix} event remove`,
|