Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions docs/docs/cmd/outlook/calendar/calendar-get.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ m365 outlook calendar get [options]
<Tabs>
<TabItem value="Delegated">

| Resource | Permissions |
|-----------------|--------------------|
| Microsoft Graph | Calendar.ReadBasic |
| Resource | Permissions |
|-----------------|----------------|
| Microsoft Graph | Calendars.Read |

</TabItem>
<TabItem value="Application">

| Resource | Permissions |
|-----------------|--------------------|
| Microsoft Graph | Calendar.ReadBasic |
| Resource | Permissions |
|-----------------|----------------|
| Microsoft Graph | Calendars.Read |

</TabItem>
</Tabs>
Expand Down Expand Up @@ -162,4 +162,4 @@ m365 outlook calendar get --userId b743445a-112c-4fda-9afd-05943f9c7b36 --calend
```

</TabItem>
</Tabs>
</Tabs>
10 changes: 9 additions & 1 deletion src/m365/outlook/commands/calendar/calendar-get.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ describe(commands.CALENDAR_GET, () => {

afterEach(() => {
sinonUtil.restore([
request.get
request.get,
calendarGroup.getUserCalendarGroupByName
]);
});

Expand Down Expand Up @@ -111,6 +112,13 @@ describe(commands.CALENDAR_GET, () => {
assert.notStrictEqual(actual.success, true);
});

it('fails validation if neither userId nor userName is specified', () => {
const actual = commandOptionsSchema.safeParse({
id: calendarId
});
assert.notStrictEqual(actual.success, true);
});

it('fails validation if userId is not a valid GUID', () => {
const actual = commandOptionsSchema.safeParse({
id: calendarId,
Expand Down
2 changes: 1 addition & 1 deletion src/m365/outlook/commands/calendar/calendar-get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class OutlookCalendarGetCommand extends GraphCommand {
.refine(options => [options.id, options.name].filter(x => x !== undefined).length === 1, {
error: 'Specify either id or name, but not both'
})
.refine(options => !(options.userId && options.userName), {
.refine(options => [options.userId, options.userName].filter(x => x !== undefined).length === 1, {
error: 'Specify either userId or userName, but not both'
})
.refine(options => !(options.calendarGroupId && options.calendarGroupName), {
Expand Down
Loading