Skip to content

Commit 3482cbf

Browse files
committed
Fixes 'Outlook Calendar Get' validation and permissions issues
1 parent 6d1d954 commit 3482cbf

3 files changed

Lines changed: 15 additions & 8 deletions

File tree

docs/docs/cmd/outlook/calendar/calendar-get.mdx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@ m365 outlook calendar get [options]
4141
<Tabs>
4242
<TabItem value="Delegated">
4343

44-
| Resource | Permissions |
45-
|-----------------|--------------------|
46-
| Microsoft Graph | Calendar.ReadBasic |
44+
| Resource | Permissions |
45+
|-----------------|----------------|
46+
| Microsoft Graph | Calendars.Read |
4747

4848
</TabItem>
4949
<TabItem value="Application">
5050

51-
| Resource | Permissions |
52-
|-----------------|--------------------|
53-
| Microsoft Graph | Calendar.ReadBasic |
51+
| Resource | Permissions |
52+
|-----------------|----------------|
53+
| Microsoft Graph | Calendars.Read |
5454

5555
</TabItem>
5656
</Tabs>
@@ -162,4 +162,4 @@ m365 outlook calendar get --userId b743445a-112c-4fda-9afd-05943f9c7b36 --calend
162162
```
163163

164164
</TabItem>
165-
</Tabs>
165+
</Tabs>

src/m365/outlook/commands/calendar/calendar-get.spec.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,13 @@ describe(commands.CALENDAR_GET, () => {
111111
assert.notStrictEqual(actual.success, true);
112112
});
113113

114+
it('fails validation if neither userId nor userName is specified', () => {
115+
const actual = commandOptionsSchema.safeParse({
116+
id: calendarId
117+
});
118+
assert.notStrictEqual(actual.success, true);
119+
});
120+
114121
it('fails validation if userId is not a valid GUID', () => {
115122
const actual = commandOptionsSchema.safeParse({
116123
id: calendarId,

src/m365/outlook/commands/calendar/calendar-get.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class OutlookCalendarGetCommand extends GraphCommand {
4848
.refine(options => [options.id, options.name].filter(x => x !== undefined).length === 1, {
4949
error: 'Specify either id or name, but not both'
5050
})
51-
.refine(options => !(options.userId && options.userName), {
51+
.refine(options => [options.userId, options.userName].filter(x => x !== undefined).length === 1, {
5252
error: 'Specify either userId or userName, but not both'
5353
})
5454
.refine(options => !(options.calendarGroupId && options.calendarGroupName), {

0 commit comments

Comments
 (0)