@pnp/cli-microsoft365 12.0.0-beta.1752794 → 12.0.0-beta.235caf5
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/Auth.js +19 -2
- package/dist/cli/cli.js +3 -0
- package/dist/config.js +1 -0
- package/dist/m365/cli/commands/cli-consent.js +9 -2
- package/dist/m365/entra/commands/agent/agent-blueprint-list.js +52 -0
- package/dist/m365/entra/commands/m365group/m365group-add.js +52 -97
- package/dist/m365/entra/commands/m365group/m365group-conversation-list.js +20 -33
- package/dist/m365/entra/commands/m365group/m365group-conversation-post-list.js +20 -39
- package/dist/m365/entra/commands/m365group/m365group-get.js +20 -41
- package/dist/m365/entra/commands/m365group/m365group-list.js +11 -31
- package/dist/m365/entra/commands/m365group/m365group-recyclebinitem-clear.js +8 -22
- package/dist/m365/entra/commands/m365group/m365group-recyclebinitem-list.js +9 -25
- package/dist/m365/entra/commands/m365group/m365group-recyclebinitem-remove.js +21 -43
- package/dist/m365/entra/commands/m365group/m365group-recyclebinitem-restore.js +21 -41
- package/dist/m365/entra/commands/m365group/m365group-remove.js +25 -46
- package/dist/m365/entra/commands/m365group/m365group-renew.js +19 -32
- package/dist/m365/entra/commands/m365group/m365group-set.js +86 -141
- package/dist/m365/entra/commands/m365group/m365group-teamify.js +20 -43
- package/dist/m365/entra/commands/m365group/m365group-user-add.js +44 -77
- package/dist/m365/entra/commands/m365group/m365group-user-list.js +28 -55
- package/dist/m365/entra/commands/m365group/m365group-user-remove.js +37 -74
- package/dist/m365/entra/commands/m365group/m365group-user-set.js +45 -77
- package/dist/m365/entra/commands.js +1 -0
- package/dist/m365/graph/commands/schemaextension/schemaextension-list.js +14 -16
- package/dist/m365/outlook/commands/calendargroup/calendargroup-add.js +97 -0
- package/dist/m365/outlook/commands/event/event-add.js +324 -0
- package/dist/m365/outlook/commands.js +2 -0
- package/dist/m365/spe/commands/container/container-permission-add.js +114 -0
- package/dist/m365/spe/commands/container/container-permission-remove.js +94 -0
- package/dist/m365/spe/commands/container/container-permission-set.js +90 -0
- package/dist/m365/spe/commands.js +3 -0
- package/dist/m365/spfx/commands/SpfxCompatibilityMatrix.js +15 -0
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.24.0.js +19 -0
- package/dist/m365/spfx/commands/project/project-doctor.js +2 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN012021_TSC_excludeDirectories.js +43 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN027002_OVERRIDES_qs.js +33 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN027003_OVERRIDES_uuid.js +33 -0
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.24.0.js +77 -0
- package/dist/m365/spfx/commands/project/project-upgrade.js +2 -1
- package/dist/m365/spo/commands/commandset/commandset-add.js +17 -59
- package/dist/m365/spo/commands/commandset/commandset-get.js +24 -62
- package/dist/m365/spo/commands/commandset/commandset-list.js +11 -34
- package/dist/m365/spo/commands/commandset/commandset-remove.js +21 -54
- package/dist/m365/spo/commands/commandset/commandset-set.js +30 -83
- package/dist/m365/spo/commands/contenttype/contenttype-add.js +22 -51
- package/dist/m365/spo/commands/contenttype/contenttype-field-list.js +38 -62
- package/dist/m365/spo/commands/contenttype/contenttype-field-remove.js +25 -54
- package/dist/m365/spo/commands/contenttype/contenttype-field-set.js +20 -43
- package/dist/m365/spo/commands/contenttype/contenttype-get.js +29 -54
- package/dist/m365/spo/commands/contenttype/contenttype-list.js +13 -30
- package/dist/m365/spo/commands/contenttype/contenttype-remove.js +24 -39
- package/dist/m365/spo/commands/contenttype/contenttype-set.js +42 -63
- package/dist/m365/spo/commands/contenttype/contenttype-sync.js +37 -59
- package/dist/m365/spo/commands/contenttypehub/contenttypehub-get.js +5 -0
- package/dist/m365/spo/commands/customaction/customaction-add.js +124 -145
- package/dist/m365/spo/commands/customaction/customaction-clear.js +12 -43
- package/dist/m365/spo/commands/customaction/customaction-get.js +28 -59
- package/dist/m365/spo/commands/customaction/customaction-list.js +12 -42
- package/dist/m365/spo/commands/customaction/customaction-remove.js +26 -54
- package/dist/m365/spo/commands/customaction/customaction-set.js +75 -132
- package/dist/m365/spo/commands/externaluser/externaluser-list.js +5 -14
- package/dist/m365/spo/commands/knowledgehub/knowledgehub-get.js +5 -0
- package/dist/m365/spo/commands/knowledgehub/knowledgehub-remove.js +8 -22
- package/dist/m365/spo/commands/knowledgehub/knowledgehub-set.js +10 -18
- package/dist/m365/spo/commands/listitem/listitem-add.js +27 -55
- package/dist/m365/spo/commands/listitem/listitem-attachment-add.js +30 -58
- package/dist/m365/spo/commands/listitem/listitem-attachment-get.js +27 -52
- package/dist/m365/spo/commands/listitem/listitem-attachment-list.js +26 -50
- package/dist/m365/spo/commands/listitem/listitem-attachment-remove.js +28 -55
- package/dist/m365/spo/commands/listitem/listitem-attachment-set.js +30 -57
- package/dist/m365/spo/commands/listitem/listitem-batch-add.js +36 -58
- package/dist/m365/spo/commands/listitem/listitem-batch-remove.js +68 -92
- package/dist/m365/spo/commands/listitem/listitem-batch-set.js +37 -57
- package/dist/m365/spo/commands/listitem/listitem-get.js +45 -68
- package/dist/m365/spo/commands/listitem/listitem-isrecord.js +31 -55
- package/dist/m365/spo/commands/listitem/listitem-list.js +47 -81
- package/dist/m365/spo/commands/listitem/listitem-record-declare.js +37 -60
- package/dist/m365/spo/commands/listitem/listitem-record-lock.js +30 -52
- package/dist/m365/spo/commands/listitem/listitem-record-undeclare.js +31 -52
- package/dist/m365/spo/commands/listitem/listitem-record-unlock.js +30 -52
- package/dist/m365/spo/commands/listitem/listitem-remove.js +33 -61
- package/dist/m365/spo/commands/listitem/listitem-retentionlabel-ensure.js +46 -67
- package/dist/m365/spo/commands/listitem/listitem-retentionlabel-remove.js +33 -56
- package/dist/m365/spo/commands/listitem/listitem-roleassignment-add.js +55 -98
- package/dist/m365/spo/commands/listitem/listitem-roleassignment-remove.js +48 -74
- package/dist/m365/spo/commands/listitem/listitem-roleinheritance-break.js +33 -56
- package/dist/m365/spo/commands/listitem/listitem-roleinheritance-reset.js +31 -53
- package/dist/m365/spo/commands/listitem/listitem-set.js +33 -58
- package/dist/m365/spo/commands/navigation/navigation-node-add.js +74 -120
- package/dist/m365/spo/commands/navigation/navigation-node-get.js +4 -13
- package/dist/m365/spo/commands/navigation/navigation-node-list.js +1 -1
- package/dist/m365/spo/commands/navigation/navigation-node-remove.js +13 -47
- package/dist/m365/spo/commands/navigation/navigation-node-set.js +53 -114
- package/dist/m365/spo/commands/orgassetslibrary/orgassetslibrary-list.js +1 -1
- package/dist/m365/spo/commands/page/page-column-list.js +7 -8
- package/dist/m365/spo/commands/page/page-section-list.js +15 -17
- package/dist/m365/spo/commands/page/page-unpublish.js +53 -0
- package/dist/m365/spo/commands/sitescript/sitescript-add.js +22 -37
- package/dist/m365/spo/commands/sitescript/sitescript-get.js +9 -26
- package/dist/m365/spo/commands/sitescript/sitescript-list.js +5 -0
- package/dist/m365/spo/commands/sitescript/sitescript-remove.js +9 -33
- package/dist/m365/spo/commands/sitescript/sitescript-set.js +29 -56
- package/dist/m365/spo/commands/spo-search.js +43 -116
- package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-add.js +8 -1
- package/dist/m365/spo/commands/tenant/tenant-commandset-add.js +8 -1
- package/dist/m365/spo/commands/term/term-group-list.js +7 -8
- package/dist/m365/spo/commands/term/term-set-list.js +6 -9
- package/dist/m365/spo/commands.js +1 -0
- package/dist/m365/spp/commands/contentcenter/contentcenter-list.js +5 -0
- package/dist/m365/spp/commands/model/model-get.js +25 -45
- package/dist/m365/spp/commands/model/model-list.js +12 -23
- package/dist/m365/spp/commands/model/model-remove.js +25 -45
- package/dist/m365/teams/commands/app/app-install.js +35 -44
- package/dist/m365/teams/commands/app/app-list.js +8 -33
- package/dist/m365/teams/commands/app/app-publish.js +21 -27
- package/dist/m365/teams/commands/app/app-remove.js +22 -39
- package/dist/m365/teams/commands/app/app-uninstall.js +12 -34
- package/dist/m365/teams/commands/app/app-update.js +35 -45
- package/dist/m365/teams/commands/funsettings/funsettings-list.js +12 -23
- package/dist/m365/teams/commands/funsettings/funsettings-set.js +18 -54
- package/dist/m365/teams/commands/guestsettings/guestsettings-list.js +12 -23
- package/dist/m365/teams/commands/guestsettings/guestsettings-set.js +15 -40
- package/dist/m365/teams/commands/meeting/meeting-add.js +57 -68
- package/dist/m365/teams/commands/meeting/meeting-attendancereport-get.js +33 -58
- package/dist/m365/teams/commands/meeting/meeting-attendancereport-list.js +14 -38
- package/dist/m365/teams/commands/meeting/meeting-get.js +14 -38
- package/dist/m365/teams/commands/meeting/meeting-list.js +34 -59
- package/dist/m365/teams/commands/meeting/meeting-transcript-get.js +34 -58
- package/dist/m365/teams/commands/meeting/meeting-transcript-list.js +29 -50
- package/dist/m365/teams/commands/membersettings/membersettings-list.js +12 -23
- package/dist/m365/teams/commands/membersettings/membersettings-set.js +18 -49
- package/dist/m365/teams/commands/message/message-get.js +19 -30
- package/dist/m365/teams/commands/message/message-list.js +26 -43
- package/dist/m365/teams/commands/message/message-remove.js +43 -58
- package/dist/m365/teams/commands/message/message-reply-list.js +19 -30
- package/dist/m365/teams/commands/message/message-restore.js +40 -50
- package/dist/m365/teams/commands/message/message-send.js +19 -30
- package/dist/m365/teams/commands/messagingsettings/messagingsettings-list.js +12 -23
- package/dist/m365/teams/commands/messagingsettings/messagingsettings-set.js +18 -60
- package/dist/m365/teams/commands/report/report-deviceusagedistributionusercounts.js +10 -0
- package/dist/m365/teams/commands/report/report-deviceusageusercounts.js +10 -0
- package/dist/m365/teams/commands/report/report-deviceusageuserdetail.js +22 -0
- package/dist/m365/teams/commands/report/report-directroutingcalls.js +19 -39
- package/dist/m365/teams/commands/report/report-pstncalls.js +19 -39
- package/dist/m365/teams/commands/report/report-useractivitycounts.js +10 -0
- package/dist/m365/teams/commands/report/report-useractivityusercounts.js +10 -0
- package/dist/m365/teams/commands/report/report-useractivityuserdetail.js +22 -0
- package/dist/m365/teams/commands/tab/tab-add.js +23 -49
- package/dist/m365/teams/commands/tab/tab-get.js +55 -56
- package/dist/m365/teams/commands/tab/tab-list.js +17 -28
- package/dist/m365/teams/commands/tab/tab-remove.js +23 -42
- package/dist/m365/teams/commands/team/team-add.js +76 -114
- package/dist/m365/teams/commands/team/team-app-list.js +23 -36
- package/dist/m365/teams/commands/team/team-archive.js +24 -39
- package/dist/m365/teams/commands/team/team-clone.js +28 -62
- package/dist/m365/teams/commands/team/team-get.js +23 -36
- package/dist/m365/teams/commands/team/team-list.js +43 -57
- package/dist/m365/teams/commands/team/team-remove.js +24 -37
- package/dist/m365/teams/commands/team/team-set.js +23 -52
- package/dist/m365/teams/commands/team/team-unarchive.js +23 -28
- package/dist/m365/teams/commands/user/user-app-add.js +40 -49
- package/dist/m365/teams/commands/user/user-app-list.js +26 -39
- package/dist/m365/teams/commands/user/user-app-remove.js +37 -49
- package/dist/m365/teams/commands/user/user-app-upgrade.js +36 -52
- package/dist/m365/teams/commands/user/user-list.js +17 -39
- package/dist/m365/tenant/commands/report/report-activeusercounts.js +2 -1
- package/dist/m365/tenant/commands/report/report-activeuserdetail.js +2 -1
- package/dist/m365/tenant/commands/report/report-office365activationcounts.js +9 -0
- package/dist/m365/tenant/commands/report/report-office365activationsusercounts.js +9 -0
- package/dist/m365/tenant/commands/report/report-office365activationsuserdetail.js +9 -0
- package/dist/m365/tenant/commands/report/report-servicesusercounts.js +2 -1
- package/dist/m365/tenant/commands/report/report-settings-get.js +5 -0
- package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-health-get.js +9 -20
- package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-health-list.js +8 -20
- package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-healthissue-get.js +8 -15
- package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-healthissue-list.js +8 -15
- package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-message-get.js +12 -26
- package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-message-list.js +8 -22
- package/dist/utils/calendar.js +1 -1
- package/dist/utils/formatting.js +16 -0
- package/dist/utils/pid.js +7 -16
- package/dist/utils/spe.js +1 -1
- package/dist/utils/spo.js +39 -0
- package/dist/utils/validation.js +24 -0
- package/dist/utils/zod.js +17 -7
- package/docs/docs/cmd/entra/agent/agent-blueprint-list.mdx +175 -0
- package/docs/docs/cmd/login.mdx +15 -2
- package/docs/docs/cmd/outlook/calendargroup/calendargroup-add.mdx +126 -0
- package/docs/docs/cmd/outlook/event/event-add.mdx +390 -0
- package/docs/docs/cmd/spe/container/container-add.mdx +0 -8
- package/docs/docs/cmd/spe/container/container-list.mdx +0 -8
- package/docs/docs/cmd/spe/container/container-permission-add.mdx +140 -0
- package/docs/docs/cmd/spe/container/container-permission-remove.mdx +78 -0
- package/docs/docs/cmd/spe/container/container-permission-set.mdx +78 -0
- package/docs/docs/cmd/spe/container/container-recyclebinitem-list.mdx +0 -8
- package/docs/docs/cmd/spe/container/container-recyclebinitem-restore.mdx +0 -8
- package/docs/docs/cmd/spe/container/container-remove.mdx +0 -8
- package/docs/docs/cmd/spe/containertype/containertype-add.mdx +1 -1
- package/docs/docs/cmd/spfx/project/project-upgrade.mdx +1 -1
- package/docs/docs/cmd/spo/externaluser/externaluser-list.mdx +17 -30
- package/docs/docs/cmd/spo/navigation/navigation-node-add.mdx +45 -30
- package/docs/docs/cmd/spo/navigation/navigation-node-get.mdx +64 -42
- package/docs/docs/cmd/spo/navigation/navigation-node-set.mdx +10 -8
- package/docs/docs/cmd/spo/orgassetslibrary/orgassetslibrary-list.mdx +0 -21
- package/docs/docs/cmd/spo/page/page-unpublish.mdx +63 -0
- package/docs/docs/cmd/teams/tab/tab-add.mdx +19 -0
- package/docs/docs/cmd/teams/tab/tab-get.mdx +19 -0
- package/docs/docs/cmd/teams/tab/tab-list.mdx +19 -0
- package/docs/docs/cmd/teams/tab/tab-remove.mdx +21 -0
- package/docs/docs/cmd/viva/engage/engage-message-add.mdx +17 -0
- package/docs/docs/cmd/viva/engage/engage-message-get.mdx +17 -0
- package/docs/docs/cmd/viva/engage/engage-message-list.mdx +17 -0
- package/docs/docs/cmd/viva/engage/engage-message-remove.mdx +19 -0
- package/package.json +4 -6
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import GraphCommand from '../../../base/GraphCommand.js';
|
|
3
|
+
import commands from '../../commands.js';
|
|
4
|
+
import { validation } from '../../../../utils/validation.js';
|
|
5
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
6
|
+
import request from '../../../../request.js';
|
|
7
|
+
import { calendar } from '../../../../utils/calendar.js';
|
|
8
|
+
import fs from 'fs';
|
|
9
|
+
import { accessToken } from '../../../../utils/accessToken.js';
|
|
10
|
+
import auth from '../../../../Auth.js';
|
|
11
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
12
|
+
const bodyContentTypes = ['Text', 'HTML'];
|
|
13
|
+
const importances = ['low', 'normal', 'high'];
|
|
14
|
+
const onlineMeetingProviders = ['teamsForBusiness', 'skypeForBusiness', 'skypeForConsumer', 'unknown'];
|
|
15
|
+
const sensitivities = ['normal', 'personal', 'private', 'confidential'];
|
|
16
|
+
const showAsStatuses = ['free', 'tentative', 'busy', 'oof', 'workingElsewhere', 'unknown'];
|
|
17
|
+
export const options = z.strictObject({
|
|
18
|
+
...globalOptionsZod.shape,
|
|
19
|
+
subject: z.string().trim().min(1, 'Subject cannot be empty.'),
|
|
20
|
+
start: z.string().refine(date => validation.isValidGraphDateTime(date), {
|
|
21
|
+
error: e => `'${e.input}' is not a valid date.`
|
|
22
|
+
}),
|
|
23
|
+
end: z.string().refine(date => validation.isValidGraphDateTime(date), {
|
|
24
|
+
error: e => `'${e.input}' is not a valid date.`
|
|
25
|
+
}),
|
|
26
|
+
userId: z.string().refine(id => validation.isValidGuid(id), {
|
|
27
|
+
error: e => `'${e.input}' is not a valid GUID.`
|
|
28
|
+
}).optional(),
|
|
29
|
+
userName: z.string().refine(name => validation.isValidUserPrincipalName(name), {
|
|
30
|
+
error: e => `'${e.input}' is not a valid UPN.`
|
|
31
|
+
}).optional(),
|
|
32
|
+
calendarId: z.string().optional(),
|
|
33
|
+
calendarName: z.string().optional(),
|
|
34
|
+
allowNewTimeProposals: z.boolean().optional().default(true),
|
|
35
|
+
bodyContents: z.string().optional(),
|
|
36
|
+
bodyContentType: z.preprocess(val => {
|
|
37
|
+
const target = String(val).toLowerCase();
|
|
38
|
+
return bodyContentTypes.find(t => t.toLowerCase() === target) ?? val;
|
|
39
|
+
}, z.enum(bodyContentTypes)).optional().default('HTML'),
|
|
40
|
+
categories: z.string()
|
|
41
|
+
.transform(value => value.split(',').map(category => category.trim()))
|
|
42
|
+
.refine(values => values.every(Boolean), {
|
|
43
|
+
error: 'Categories cannot contain empty entries.'
|
|
44
|
+
})
|
|
45
|
+
.optional(),
|
|
46
|
+
hideAttendees: z.boolean().optional().default(false),
|
|
47
|
+
importance: z.preprocess(val => {
|
|
48
|
+
const target = String(val).toLowerCase();
|
|
49
|
+
return importances.find(t => t.toLowerCase() === target) ?? val;
|
|
50
|
+
}, z.enum(importances)).optional(),
|
|
51
|
+
isAllDay: z.boolean().optional().default(false),
|
|
52
|
+
isOnlineMeeting: z.boolean().optional().default(false),
|
|
53
|
+
isReminderOn: z.boolean().optional().default(true),
|
|
54
|
+
location: z.string().optional(),
|
|
55
|
+
locationEmailAddress: z.string().refine(name => validation.isValidUserPrincipalName(name), {
|
|
56
|
+
error: e => `'${e.input}' is not a valid email address.`
|
|
57
|
+
}).optional(),
|
|
58
|
+
locations: z.string()
|
|
59
|
+
.transform(value => value.split(',').map(location => location.trim()))
|
|
60
|
+
.refine(values => values.every(Boolean), {
|
|
61
|
+
error: 'Locations cannot contain empty entries.'
|
|
62
|
+
})
|
|
63
|
+
.optional(),
|
|
64
|
+
onlineMeetingProvider: z.preprocess(val => {
|
|
65
|
+
const target = String(val).toLowerCase();
|
|
66
|
+
return onlineMeetingProviders.find(t => t.toLowerCase() === target) ?? val;
|
|
67
|
+
}, z.enum(onlineMeetingProviders)).optional().default('unknown'),
|
|
68
|
+
optionalAttendees: z.string()
|
|
69
|
+
.refine(names => validation.isValidUserPrincipalNameArray(names) === true, {
|
|
70
|
+
error: e => `The following attendees names are invalid for the option 'optionalAttendees': ${validation.isValidUserPrincipalNameArray(e.input)}.`
|
|
71
|
+
}).transform((value) => value.split(',').map(String)).optional(),
|
|
72
|
+
recurrence: z.string().optional(),
|
|
73
|
+
reminderMinutesBeforeStart: z.number().refine(minutes => Number.isInteger(minutes) && minutes >= 0, {
|
|
74
|
+
error: () => 'The number of reminder minutes must be a positive number or 0.'
|
|
75
|
+
}).optional(),
|
|
76
|
+
requiredAttendees: z.string()
|
|
77
|
+
.refine(names => validation.isValidUserPrincipalNameArray(names) === true, {
|
|
78
|
+
error: e => `The following attendees names are invalid for the option 'requiredAttendees': ${validation.isValidUserPrincipalNameArray(e.input)}.`
|
|
79
|
+
}).transform((value) => value.split(',').map(String)).optional(),
|
|
80
|
+
resources: z.string()
|
|
81
|
+
.refine(names => validation.isValidUserPrincipalNameArray(names) === true, {
|
|
82
|
+
error: e => `The following attendees names are invalid for the option 'resources': ${validation.isValidUserPrincipalNameArray(e.input)}.`
|
|
83
|
+
}).transform((value) => value.split(',').map(String)).optional(),
|
|
84
|
+
responseRequested: z.boolean().optional().default(true),
|
|
85
|
+
sensitivity: z.preprocess(val => {
|
|
86
|
+
const target = String(val).toLowerCase();
|
|
87
|
+
return sensitivities.find(t => t.toLowerCase() === target) ?? val;
|
|
88
|
+
}, z.enum(sensitivities)).optional(),
|
|
89
|
+
showAs: z.preprocess(val => {
|
|
90
|
+
const target = String(val).toLowerCase();
|
|
91
|
+
return showAsStatuses.find(t => t.toLowerCase() === target) ?? val;
|
|
92
|
+
}, z.enum(showAsStatuses)).optional().default('busy'),
|
|
93
|
+
timeZone: z.string().optional().default('UTC'),
|
|
94
|
+
transactionId: z.string().optional()
|
|
95
|
+
});
|
|
96
|
+
class OutlookEventAddCommand extends GraphCommand {
|
|
97
|
+
get name() {
|
|
98
|
+
return commands.EVENT_ADD;
|
|
99
|
+
}
|
|
100
|
+
get description() {
|
|
101
|
+
return `Create an event in the default calendar or a specific calendar of a user`;
|
|
102
|
+
}
|
|
103
|
+
get schema() {
|
|
104
|
+
return options;
|
|
105
|
+
}
|
|
106
|
+
getRefinedSchema(schema) {
|
|
107
|
+
return schema
|
|
108
|
+
.refine(options => !(options.calendarId && options.calendarName), {
|
|
109
|
+
error: 'Specify either calendarId or calendarName, but not both.'
|
|
110
|
+
})
|
|
111
|
+
.refine(options => !(options.location && options.locations), {
|
|
112
|
+
error: 'Specify either location or locations, but not both.'
|
|
113
|
+
})
|
|
114
|
+
.refine(options => !(options.userId && options.userName), {
|
|
115
|
+
error: 'Specify either userId or userName, but not both.'
|
|
116
|
+
})
|
|
117
|
+
.refine(options => !options.isAllDay || (options.start.endsWith('T00:00:00') && options.end.endsWith('T00:00:00')), {
|
|
118
|
+
error: 'When isAllDay is true, start and end must be set to midnight.'
|
|
119
|
+
})
|
|
120
|
+
.refine(options => !(options.reminderMinutesBeforeStart !== undefined && !options.isReminderOn), {
|
|
121
|
+
error: 'When reminderMinutesBeforeStart is specified, isReminderOn must be true.'
|
|
122
|
+
})
|
|
123
|
+
.refine(options => !(options.locationEmailAddress && !options.location), {
|
|
124
|
+
error: 'When locationEmailAddress is specified, location must be also specified.'
|
|
125
|
+
})
|
|
126
|
+
.refine(options => new Date(options.start).getTime() < new Date(options.end).getTime(), {
|
|
127
|
+
error: 'Start date must be before end date.'
|
|
128
|
+
})
|
|
129
|
+
.refine(options => !options.isOnlineMeeting || options.onlineMeetingProvider !== 'unknown', {
|
|
130
|
+
error: 'Specify onlineMeetingProvider when isOnlineMeeting is true.'
|
|
131
|
+
})
|
|
132
|
+
.refine(options => options.isOnlineMeeting || options.onlineMeetingProvider === 'unknown', {
|
|
133
|
+
error: 'onlineMeetingProvider can only be specified when isOnlineMeeting is true.'
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
async commandAction(logger, args) {
|
|
137
|
+
const isAppOnlyAccessToken = accessToken.isAppOnlyAccessToken(auth.connection.accessTokens[auth.defaultResource].accessToken);
|
|
138
|
+
let principalUrl = '';
|
|
139
|
+
const token = auth.connection.accessTokens[auth.defaultResource].accessToken;
|
|
140
|
+
if (isAppOnlyAccessToken) {
|
|
141
|
+
if (!args.options.userId && !args.options.userName) {
|
|
142
|
+
throw `The option 'userId' or 'userName' is required when creating an event using application permissions.`;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
if (args.options.userId) {
|
|
147
|
+
const currentUserId = accessToken.getUserIdFromAccessToken(token);
|
|
148
|
+
if (args.options.userId.toLowerCase() !== currentUserId.toLowerCase()) {
|
|
149
|
+
throw `You can only create your own events when using delegated permissions. The specified userId '${args.options.userId}' does not match the current user '${currentUserId}'.`;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if (args.options.userName) {
|
|
153
|
+
const currentUserName = accessToken.getUserNameFromAccessToken(token);
|
|
154
|
+
if (args.options.userName.toLowerCase() !== currentUserName.toLowerCase()) {
|
|
155
|
+
throw `You can only create your own events when using delegated permissions. The specified userName '${args.options.userName}' does not match the current user '${currentUserName}'.`;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
let userIdentifier;
|
|
160
|
+
if (args.options.userId || args.options.userName) {
|
|
161
|
+
userIdentifier = args.options.userId ?? args.options.userName;
|
|
162
|
+
principalUrl += `users('${formatting.encodeQueryParameter(userIdentifier)}')`;
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
userIdentifier = accessToken.getUserNameFromAccessToken(token);
|
|
166
|
+
principalUrl += 'me';
|
|
167
|
+
}
|
|
168
|
+
if (this.verbose) {
|
|
169
|
+
await logger.logToStderr(`Creating event for user ${userIdentifier}...`);
|
|
170
|
+
}
|
|
171
|
+
let calendarId = args.options.calendarId;
|
|
172
|
+
if (args.options.calendarName) {
|
|
173
|
+
calendarId = (await calendar.getUserCalendarByName(userIdentifier, args.options.calendarName)).id;
|
|
174
|
+
}
|
|
175
|
+
let requestUrl = `${this.resource}/v1.0/${principalUrl}`;
|
|
176
|
+
if (calendarId) {
|
|
177
|
+
requestUrl += `/calendars/${formatting.encodeQueryParameter(calendarId)}/events`;
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
requestUrl += '/events';
|
|
181
|
+
}
|
|
182
|
+
const body = {};
|
|
183
|
+
body.subject = args.options.subject;
|
|
184
|
+
body.start = {
|
|
185
|
+
dateTime: args.options.start
|
|
186
|
+
};
|
|
187
|
+
body.end = {
|
|
188
|
+
dateTime: args.options.end
|
|
189
|
+
};
|
|
190
|
+
if (args.options.bodyContents !== undefined) {
|
|
191
|
+
const bodyContents = args.options.bodyContents.startsWith('@')
|
|
192
|
+
? fs.readFileSync(args.options.bodyContents.substring(1), 'utf8')
|
|
193
|
+
: args.options.bodyContents;
|
|
194
|
+
body.body = {
|
|
195
|
+
contentType: args.options.bodyContentType === 'Text' ? 'text' : 'html',
|
|
196
|
+
content: bodyContents
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
if (!args.options.allowNewTimeProposals) {
|
|
200
|
+
body.allowNewTimeProposals = args.options.allowNewTimeProposals;
|
|
201
|
+
}
|
|
202
|
+
if (args.options.categories) {
|
|
203
|
+
body.categories = args.options.categories;
|
|
204
|
+
}
|
|
205
|
+
if (args.options.hideAttendees) {
|
|
206
|
+
body.hideAttendees = args.options.hideAttendees;
|
|
207
|
+
}
|
|
208
|
+
if (args.options.importance) {
|
|
209
|
+
body.importance = args.options.importance;
|
|
210
|
+
}
|
|
211
|
+
if (args.options.isAllDay) {
|
|
212
|
+
body.isAllDay = args.options.isAllDay;
|
|
213
|
+
}
|
|
214
|
+
if (args.options.isOnlineMeeting) {
|
|
215
|
+
body.isOnlineMeeting = args.options.isOnlineMeeting;
|
|
216
|
+
}
|
|
217
|
+
if (!args.options.isReminderOn) {
|
|
218
|
+
body.isReminderOn = false;
|
|
219
|
+
}
|
|
220
|
+
if (args.options.location || args.options.locationEmailAddress) {
|
|
221
|
+
const location = {};
|
|
222
|
+
if (args.options.location) {
|
|
223
|
+
location.displayName = args.options.location;
|
|
224
|
+
}
|
|
225
|
+
if (args.options.locationEmailAddress) {
|
|
226
|
+
location.locationEmailAddress = args.options.locationEmailAddress;
|
|
227
|
+
}
|
|
228
|
+
body.location = location;
|
|
229
|
+
}
|
|
230
|
+
if (args.options.locations) {
|
|
231
|
+
const locations = args.options.locations.map(displayName => ({
|
|
232
|
+
displayName
|
|
233
|
+
}));
|
|
234
|
+
body.locations = locations;
|
|
235
|
+
}
|
|
236
|
+
if (args.options.onlineMeetingProvider !== 'unknown') {
|
|
237
|
+
body.onlineMeetingProvider = args.options.onlineMeetingProvider;
|
|
238
|
+
}
|
|
239
|
+
if (args.options.optionalAttendees || args.options.requiredAttendees || args.options.resources) {
|
|
240
|
+
const attendees = [];
|
|
241
|
+
const resolveAttendee = (value) => {
|
|
242
|
+
const attendee = value.trim();
|
|
243
|
+
if (attendee.toLowerCase() !== '@meusername') {
|
|
244
|
+
return attendee;
|
|
245
|
+
}
|
|
246
|
+
if (isAppOnlyAccessToken) {
|
|
247
|
+
throw `It's not possible to use ${attendee} with application permissions`;
|
|
248
|
+
}
|
|
249
|
+
return accessToken.getUserNameFromAccessToken(token);
|
|
250
|
+
};
|
|
251
|
+
if (args.options.optionalAttendees) {
|
|
252
|
+
args.options.optionalAttendees.forEach(value => attendees.push({
|
|
253
|
+
emailAddress: {
|
|
254
|
+
address: resolveAttendee(value)
|
|
255
|
+
},
|
|
256
|
+
type: 'optional'
|
|
257
|
+
}));
|
|
258
|
+
}
|
|
259
|
+
if (args.options.requiredAttendees) {
|
|
260
|
+
args.options.requiredAttendees.forEach(value => attendees.push({
|
|
261
|
+
emailAddress: {
|
|
262
|
+
address: resolveAttendee(value)
|
|
263
|
+
},
|
|
264
|
+
type: 'required'
|
|
265
|
+
}));
|
|
266
|
+
}
|
|
267
|
+
if (args.options.resources) {
|
|
268
|
+
args.options.resources.forEach(value => attendees.push({
|
|
269
|
+
emailAddress: {
|
|
270
|
+
address: resolveAttendee(value)
|
|
271
|
+
},
|
|
272
|
+
type: 'resource'
|
|
273
|
+
}));
|
|
274
|
+
}
|
|
275
|
+
body.attendees = attendees;
|
|
276
|
+
}
|
|
277
|
+
if (args.options.recurrence) {
|
|
278
|
+
if (args.options.recurrence.startsWith('@')) {
|
|
279
|
+
const fileRecurrence = fs.readFileSync(args.options.recurrence.replace('@', ''), 'utf8');
|
|
280
|
+
body.recurrence = JSON.parse(fileRecurrence);
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
283
|
+
body.recurrence = JSON.parse(args.options.recurrence);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
if (args.options.isReminderOn && args.options.reminderMinutesBeforeStart !== undefined) {
|
|
287
|
+
body.reminderMinutesBeforeStart = args.options.reminderMinutesBeforeStart;
|
|
288
|
+
}
|
|
289
|
+
if (!args.options.responseRequested) {
|
|
290
|
+
body.responseRequested = false;
|
|
291
|
+
}
|
|
292
|
+
if (args.options.sensitivity) {
|
|
293
|
+
body.sensitivity = args.options.sensitivity;
|
|
294
|
+
}
|
|
295
|
+
if (args.options.showAs !== 'busy') {
|
|
296
|
+
body.showAs = args.options.showAs;
|
|
297
|
+
}
|
|
298
|
+
if (args.options.timeZone) {
|
|
299
|
+
body.start.timeZone = args.options.timeZone;
|
|
300
|
+
body.end.timeZone = args.options.timeZone;
|
|
301
|
+
}
|
|
302
|
+
if (args.options.transactionId) {
|
|
303
|
+
body.transactionId = args.options.transactionId;
|
|
304
|
+
}
|
|
305
|
+
const requestOptions = {
|
|
306
|
+
url: requestUrl,
|
|
307
|
+
headers: {
|
|
308
|
+
accept: 'application/json;odata.metadata=none',
|
|
309
|
+
'content-type': 'application/json'
|
|
310
|
+
},
|
|
311
|
+
responseType: 'json',
|
|
312
|
+
data: body
|
|
313
|
+
};
|
|
314
|
+
try {
|
|
315
|
+
const result = await request.post(requestOptions);
|
|
316
|
+
await logger.log(result);
|
|
317
|
+
}
|
|
318
|
+
catch (err) {
|
|
319
|
+
this.handleRejectedODataJsonPromise(err);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
export default new OutlookEventAddCommand();
|
|
324
|
+
//# sourceMappingURL=event-add.js.map
|
|
@@ -5,10 +5,12 @@ export default {
|
|
|
5
5
|
CALENDAR_LIST: `${prefix} calendar list`,
|
|
6
6
|
CALENDAR_REMOVE: `${prefix} calendar remove`,
|
|
7
7
|
CALENDAR_SET: `${prefix} calendar set`,
|
|
8
|
+
CALENDARGROUP_ADD: `${prefix} calendargroup add`,
|
|
8
9
|
CALENDARGROUP_GET: `${prefix} calendargroup get`,
|
|
9
10
|
CALENDARGROUP_LIST: `${prefix} calendargroup list`,
|
|
10
11
|
CALENDARGROUP_REMOVE: `${prefix} calendargroup remove`,
|
|
11
12
|
CALENDARGROUP_SET: `${prefix} calendargroup set`,
|
|
13
|
+
EVENT_ADD: `${prefix} event add`,
|
|
12
14
|
EVENT_CANCEL: `${prefix} event cancel`,
|
|
13
15
|
EVENT_GET: `${prefix} event get`,
|
|
14
16
|
EVENT_LIST: `${prefix} event list`,
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
3
|
+
import commands from '../../commands.js';
|
|
4
|
+
import GraphCommand from '../../../base/GraphCommand.js';
|
|
5
|
+
import { validation } from '../../../../utils/validation.js';
|
|
6
|
+
import { spe } from '../../../../utils/spe.js';
|
|
7
|
+
import request from '../../../../request.js';
|
|
8
|
+
import { entraUser } from '../../../../utils/entraUser.js';
|
|
9
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
10
|
+
export const options = z.strictObject({
|
|
11
|
+
...globalOptionsZod.shape,
|
|
12
|
+
containerId: z.string().alias('i').optional(),
|
|
13
|
+
containerName: z.string().alias('n').optional(),
|
|
14
|
+
containerTypeId: z.uuid().optional(),
|
|
15
|
+
containerTypeName: z.string().optional(),
|
|
16
|
+
roles: z.string().transform((value) => value.split(',').map(role => role.trim())).pipe(z.enum(['reader', 'writer', 'manager', 'owner']).array()).alias('r'),
|
|
17
|
+
userId: z.string().refine(id => validation.isValidGuid(id), {
|
|
18
|
+
error: e => `'${e.input}' is not a valid GUID.`
|
|
19
|
+
}).optional(),
|
|
20
|
+
userName: z.string().refine(name => validation.isValidUserPrincipalName(name), {
|
|
21
|
+
error: e => `'${e.input}' is not a valid UPN.`
|
|
22
|
+
}).optional()
|
|
23
|
+
});
|
|
24
|
+
class SpeContainerPermissionAddCommand extends GraphCommand {
|
|
25
|
+
get name() {
|
|
26
|
+
return commands.CONTAINER_PERMISSION_ADD;
|
|
27
|
+
}
|
|
28
|
+
get description() {
|
|
29
|
+
return 'Adds permission to SharePoint Embedded Container for a specified user';
|
|
30
|
+
}
|
|
31
|
+
get schema() {
|
|
32
|
+
return options;
|
|
33
|
+
}
|
|
34
|
+
getRefinedSchema(schema) {
|
|
35
|
+
return schema
|
|
36
|
+
.refine((options) => [options.containerId, options.containerName].filter(o => o !== undefined).length >= 1, {
|
|
37
|
+
error: 'Use one of the following options: containerId or containerName.',
|
|
38
|
+
params: { customCode: 'optionSet', options: ['containerId', 'containerName'] }
|
|
39
|
+
})
|
|
40
|
+
.refine((options) => [options.containerId, options.containerName].filter(o => o !== undefined).length <= 1, {
|
|
41
|
+
error: 'Use one of the following options: containerId or containerName.'
|
|
42
|
+
})
|
|
43
|
+
.refine((options) => [options.userId, options.userName].filter(o => o !== undefined).length >= 1, {
|
|
44
|
+
error: 'Use one of the following options: userId or userName.',
|
|
45
|
+
params: { customCode: 'optionSet', options: ['userId', 'userName'] }
|
|
46
|
+
})
|
|
47
|
+
.refine((options) => [options.userId, options.userName].filter(o => o !== undefined).length <= 1, {
|
|
48
|
+
error: 'Use one of the following options: userId or userName.'
|
|
49
|
+
})
|
|
50
|
+
.refine((options) => !options.containerName || [options.containerTypeId, options.containerTypeName].filter(o => o !== undefined).length >= 1, {
|
|
51
|
+
error: 'Use one of the following options when specifying the container name: containerTypeId or containerTypeName.',
|
|
52
|
+
params: { customCode: 'optionSet', options: ['containerTypeId', 'containerTypeName'] }
|
|
53
|
+
})
|
|
54
|
+
.refine((options) => !options.containerName || [options.containerTypeId, options.containerTypeName].filter(o => o !== undefined).length <= 1, {
|
|
55
|
+
error: 'Use one of the following options when specifying the container name: containerTypeId or containerTypeName.'
|
|
56
|
+
})
|
|
57
|
+
.refine((options) => options.containerName || [options.containerTypeId, options.containerTypeName].filter(o => o !== undefined).length === 0, {
|
|
58
|
+
error: 'Options containerTypeId and containerTypeName are only required when adding permissions to a container by name.'
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
async commandAction(logger, args) {
|
|
62
|
+
try {
|
|
63
|
+
const containerId = await this.getContainerId(args.options, logger);
|
|
64
|
+
if (this.verbose) {
|
|
65
|
+
await logger.logToStderr(`Adding permissions to container with ID '${containerId}'...`);
|
|
66
|
+
}
|
|
67
|
+
let userName = args.options.userName;
|
|
68
|
+
if (args.options.userId) {
|
|
69
|
+
userName = await entraUser.getUpnByUserId(args.options.userId);
|
|
70
|
+
}
|
|
71
|
+
const requestOptions = {
|
|
72
|
+
url: `${this.resource}/v1.0/storage/fileStorage/containers/${formatting.encodeQueryParameter(containerId)}/permissions`,
|
|
73
|
+
headers: {
|
|
74
|
+
accept: 'application/json;odata.metadata=none'
|
|
75
|
+
},
|
|
76
|
+
responseType: 'json',
|
|
77
|
+
data: {
|
|
78
|
+
roles: args.options.roles,
|
|
79
|
+
grantedToV2: {
|
|
80
|
+
user: {
|
|
81
|
+
userPrincipalName: userName
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
const container = await request.post(requestOptions);
|
|
87
|
+
await logger.log(container);
|
|
88
|
+
}
|
|
89
|
+
catch (err) {
|
|
90
|
+
this.handleRejectedODataJsonPromise(err);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
async getContainerId(options, logger) {
|
|
94
|
+
if (options.containerId) {
|
|
95
|
+
return options.containerId;
|
|
96
|
+
}
|
|
97
|
+
const containerTypeId = await this.getContainerTypeId(options, logger);
|
|
98
|
+
if (this.verbose) {
|
|
99
|
+
await logger.logToStderr(`Getting container ID for container with name '${options.containerName}'...`);
|
|
100
|
+
}
|
|
101
|
+
return spe.getContainerIdByName(containerTypeId, options.containerName);
|
|
102
|
+
}
|
|
103
|
+
async getContainerTypeId(options, logger) {
|
|
104
|
+
if (options.containerTypeId) {
|
|
105
|
+
return options.containerTypeId;
|
|
106
|
+
}
|
|
107
|
+
if (this.verbose) {
|
|
108
|
+
await logger.logToStderr(`Getting container type with name '${options.containerTypeName}'...`);
|
|
109
|
+
}
|
|
110
|
+
return spe.getContainerTypeIdByName(options.containerTypeName);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
export default new SpeContainerPermissionAddCommand();
|
|
114
|
+
//# sourceMappingURL=container-permission-add.js.map
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
3
|
+
import commands from '../../commands.js';
|
|
4
|
+
import GraphCommand from '../../../base/GraphCommand.js';
|
|
5
|
+
import { spe } from '../../../../utils/spe.js';
|
|
6
|
+
import request from '../../../../request.js';
|
|
7
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
8
|
+
import { cli } from '../../../../cli/cli.js';
|
|
9
|
+
export const options = z.strictObject({
|
|
10
|
+
...globalOptionsZod.shape,
|
|
11
|
+
id: z.string().alias('i'),
|
|
12
|
+
containerId: z.string().optional(),
|
|
13
|
+
containerName: z.string().alias('n').optional(),
|
|
14
|
+
containerTypeId: z.uuid().optional(),
|
|
15
|
+
containerTypeName: z.string().optional(),
|
|
16
|
+
force: z.boolean().alias('f').optional()
|
|
17
|
+
});
|
|
18
|
+
class SpeContainerPermissionRemoveCommand extends GraphCommand {
|
|
19
|
+
get name() {
|
|
20
|
+
return commands.CONTAINER_PERMISSION_REMOVE;
|
|
21
|
+
}
|
|
22
|
+
get description() {
|
|
23
|
+
return 'Removes SharePoint Embedded Container permission';
|
|
24
|
+
}
|
|
25
|
+
get schema() {
|
|
26
|
+
return options;
|
|
27
|
+
}
|
|
28
|
+
getRefinedSchema(schema) {
|
|
29
|
+
return schema
|
|
30
|
+
.refine((options) => [options.containerId, options.containerName].filter(o => o !== undefined).length === 1, {
|
|
31
|
+
error: 'Use one of the following options: containerId or containerName.',
|
|
32
|
+
params: {
|
|
33
|
+
customCode: 'optionSet',
|
|
34
|
+
options: ['containerId', 'containerName']
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
.refine((options) => !options.containerName || [options.containerTypeId, options.containerTypeName].filter(o => o !== undefined).length === 1, {
|
|
38
|
+
error: 'Use one of the following options when specifying the container name: containerTypeId or containerTypeName.',
|
|
39
|
+
params: {
|
|
40
|
+
customCode: 'optionSet',
|
|
41
|
+
options: ['containerTypeId', 'containerTypeName']
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
.refine((options) => options.containerName || [options.containerTypeId, options.containerTypeName].filter(o => o !== undefined).length === 0, {
|
|
45
|
+
error: 'Options containerTypeId and containerTypeName are only required when removing permissions from a container by name.'
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
async commandAction(logger, args) {
|
|
49
|
+
if (!args.options.force) {
|
|
50
|
+
const result = await cli.promptForConfirmation({ message: `Are you sure you want to remove permission '${args.options.id}' from container '${args.options.containerId || args.options.containerName}'?` });
|
|
51
|
+
if (!result) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
const containerId = await this.getContainerId(args.options, logger);
|
|
57
|
+
if (this.verbose) {
|
|
58
|
+
await logger.logToStderr(`Removing permissions from container with ID '${containerId}'...`);
|
|
59
|
+
}
|
|
60
|
+
const requestOptions = {
|
|
61
|
+
url: `${this.resource}/v1.0/storage/fileStorage/containers/${formatting.encodeQueryParameter(containerId)}/permissions/${formatting.encodeQueryParameter(args.options.id)}`,
|
|
62
|
+
headers: {
|
|
63
|
+
accept: 'application/json;odata.metadata=none'
|
|
64
|
+
},
|
|
65
|
+
responseType: 'json'
|
|
66
|
+
};
|
|
67
|
+
await request.delete(requestOptions);
|
|
68
|
+
}
|
|
69
|
+
catch (err) {
|
|
70
|
+
this.handleRejectedODataJsonPromise(err);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
async getContainerId(options, logger) {
|
|
74
|
+
if (options.containerId) {
|
|
75
|
+
return options.containerId;
|
|
76
|
+
}
|
|
77
|
+
const containerTypeId = await this.getContainerTypeId(options, logger);
|
|
78
|
+
if (this.verbose) {
|
|
79
|
+
await logger.logToStderr(`Getting container ID for container with name '${options.containerName}'...`);
|
|
80
|
+
}
|
|
81
|
+
return spe.getContainerIdByName(containerTypeId, options.containerName);
|
|
82
|
+
}
|
|
83
|
+
async getContainerTypeId(options, logger) {
|
|
84
|
+
if (options.containerTypeId) {
|
|
85
|
+
return options.containerTypeId;
|
|
86
|
+
}
|
|
87
|
+
if (this.verbose) {
|
|
88
|
+
await logger.logToStderr(`Getting container type with name '${options.containerTypeName}'...`);
|
|
89
|
+
}
|
|
90
|
+
return spe.getContainerTypeIdByName(options.containerTypeName);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
export default new SpeContainerPermissionRemoveCommand();
|
|
94
|
+
//# sourceMappingURL=container-permission-remove.js.map
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
3
|
+
import commands from '../../commands.js';
|
|
4
|
+
import GraphCommand from '../../../base/GraphCommand.js';
|
|
5
|
+
import { spe } from '../../../../utils/spe.js';
|
|
6
|
+
import request from '../../../../request.js';
|
|
7
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
8
|
+
export const options = z.strictObject({
|
|
9
|
+
...globalOptionsZod.shape,
|
|
10
|
+
id: z.string().alias('i'),
|
|
11
|
+
containerId: z.string().optional(),
|
|
12
|
+
containerName: z.string().alias('n').optional(),
|
|
13
|
+
containerTypeId: z.uuid().optional(),
|
|
14
|
+
containerTypeName: z.string().optional(),
|
|
15
|
+
roles: z.string().transform((value) => value.split(',').map(role => role.trim())).pipe(z.enum(['reader', 'writer', 'manager', 'owner']).array()).alias('r')
|
|
16
|
+
});
|
|
17
|
+
class SpeContainerPermissionSetCommand extends GraphCommand {
|
|
18
|
+
get name() {
|
|
19
|
+
return commands.CONTAINER_PERMISSION_SET;
|
|
20
|
+
}
|
|
21
|
+
get description() {
|
|
22
|
+
return 'Updates SharePoint Embedded Container permission';
|
|
23
|
+
}
|
|
24
|
+
get schema() {
|
|
25
|
+
return options;
|
|
26
|
+
}
|
|
27
|
+
getRefinedSchema(schema) {
|
|
28
|
+
return schema
|
|
29
|
+
.refine((options) => [options.containerId, options.containerName].filter(o => o !== undefined).length === 1, {
|
|
30
|
+
error: 'Use one of the following options: containerId or containerName.',
|
|
31
|
+
params: {
|
|
32
|
+
customCode: 'optionSet',
|
|
33
|
+
options: ['containerId', 'containerName']
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
.refine((options) => !options.containerName || [options.containerTypeId, options.containerTypeName].filter(o => o !== undefined).length === 1, {
|
|
37
|
+
error: 'Use one of the following options when specifying the container name: containerTypeId or containerTypeName.',
|
|
38
|
+
params: {
|
|
39
|
+
customCode: 'optionSet',
|
|
40
|
+
options: ['containerTypeId', 'containerTypeName']
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
.refine((options) => options.containerName || [options.containerTypeId, options.containerTypeName].filter(o => o !== undefined).length === 0, {
|
|
44
|
+
error: 'Options containerTypeId and containerTypeName can only be used when specifying a container by name.'
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
async commandAction(logger, args) {
|
|
48
|
+
try {
|
|
49
|
+
const containerId = await this.getContainerId(args.options, logger);
|
|
50
|
+
if (this.verbose) {
|
|
51
|
+
await logger.logToStderr(`Updating permission for container with ID '${containerId}'...`);
|
|
52
|
+
}
|
|
53
|
+
const requestOptions = {
|
|
54
|
+
url: `${this.resource}/v1.0/storage/fileStorage/containers/${formatting.encodeQueryParameter(containerId)}/permissions/${formatting.encodeQueryParameter(args.options.id)}`,
|
|
55
|
+
headers: {
|
|
56
|
+
accept: 'application/json;odata.metadata=none'
|
|
57
|
+
},
|
|
58
|
+
responseType: 'json',
|
|
59
|
+
data: {
|
|
60
|
+
roles: args.options.roles
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
await request.patch(requestOptions);
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
this.handleRejectedODataJsonPromise(err);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
async getContainerId(options, logger) {
|
|
70
|
+
if (options.containerId) {
|
|
71
|
+
return options.containerId;
|
|
72
|
+
}
|
|
73
|
+
const containerTypeId = await this.getContainerTypeId(options, logger);
|
|
74
|
+
if (this.verbose) {
|
|
75
|
+
await logger.logToStderr(`Getting container ID for container with name '${options.containerName}'...`);
|
|
76
|
+
}
|
|
77
|
+
return spe.getContainerIdByName(containerTypeId, options.containerName);
|
|
78
|
+
}
|
|
79
|
+
async getContainerTypeId(options, logger) {
|
|
80
|
+
if (options.containerTypeId) {
|
|
81
|
+
return options.containerTypeId;
|
|
82
|
+
}
|
|
83
|
+
if (this.verbose) {
|
|
84
|
+
await logger.logToStderr(`Getting container type with name '${options.containerTypeName}'...`);
|
|
85
|
+
}
|
|
86
|
+
return spe.getContainerTypeIdByName(options.containerTypeName);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
export default new SpeContainerPermissionSetCommand();
|
|
90
|
+
//# sourceMappingURL=container-permission-set.js.map
|
|
@@ -6,7 +6,10 @@ export default {
|
|
|
6
6
|
CONTAINER_LIST: `${prefix} container list`,
|
|
7
7
|
CONTAINER_REMOVE: `${prefix} container remove`,
|
|
8
8
|
CONTAINER_SET: `${prefix} container set`,
|
|
9
|
+
CONTAINER_PERMISSION_ADD: `${prefix} container permission add`,
|
|
9
10
|
CONTAINER_PERMISSION_LIST: `${prefix} container permission list`,
|
|
11
|
+
CONTAINER_PERMISSION_REMOVE: `${prefix} container permission remove`,
|
|
12
|
+
CONTAINER_PERMISSION_SET: `${prefix} container permission set`,
|
|
10
13
|
CONTAINER_RECYCLEBINITEM_LIST: `${prefix} container recyclebinitem list`,
|
|
11
14
|
CONTAINER_RECYCLEBINITEM_REMOVE: `${prefix} container recyclebinitem remove`,
|
|
12
15
|
CONTAINER_RECYCLEBINITEM_RESTORE: `${prefix} container recyclebinitem restore`,
|
|
@@ -653,6 +653,21 @@ export const versions = {
|
|
|
653
653
|
range: '^4 || ^5 || ^6 || ^7',
|
|
654
654
|
fix: 'npm i -g yo@7'
|
|
655
655
|
}
|
|
656
|
+
},
|
|
657
|
+
'1.24.0': {
|
|
658
|
+
heft: {
|
|
659
|
+
range: '^1',
|
|
660
|
+
fix: 'npm i -g @rushstack/heft@1'
|
|
661
|
+
},
|
|
662
|
+
node: {
|
|
663
|
+
range: '>=22.14.0 <23.0.0 || >=24.0.0 <25.0.0 || >=26.0.0 <27.0.0',
|
|
664
|
+
fix: 'Install Node.js >=22.14.0 <23.0.0 || >=24.0.0 <25.0.0 || >=26.0.0 <27.0.0'
|
|
665
|
+
},
|
|
666
|
+
sp: SharePointVersion.SPO,
|
|
667
|
+
yo: {
|
|
668
|
+
range: '^4 || ^5 || ^6 || ^7',
|
|
669
|
+
fix: 'npm i -g yo@7'
|
|
670
|
+
}
|
|
656
671
|
}
|
|
657
672
|
};
|
|
658
673
|
//# sourceMappingURL=SpfxCompatibilityMatrix.js.map
|