Skip to content

Latest commit

 

History

History
300 lines (237 loc) · 10.9 KB

File metadata and controls

300 lines (237 loc) · 10.9 KB

Calendar Commands

View and create calendar events via Microsoft Graph's calendarView API.

Every calendar command accepts global options (--account, --as, --format, --json, --output, --verbose).

Commands that list events (today, week, range) assign short IDs that can be used in place of full Graph IDs in subsequent commands like calendar view and calendar delete. Short IDs are account-aware — when you reference an event by short ID, the account that listed it is automatically used (unless you pass --account explicitly).


calendar today

Show today's events in chronological order. Uses the calendarView API, which expands recurring events into individual occurrences.

outlook-cli calendar today
outlook-cli calendar today --timezone "America/New_York"
outlook-cli calendar today --json
Option Description Default
--timezone <tz> IANA timezone name for interpreting "today". Affects which calendar day is shown. System timezone
--input <file> Load options from a JSON file.

Example output (text):

#     Time             Subject                        Location
────────────────────────────────────────────────────────────────────────────
1     09:00 - 09:30    Team Standup                   Conference Room A
2     10:00 - 11:00    Design Review                  Teams Meeting
3     14:00 - 15:00    1:1 with Manager               Manager's Office

3 event(s) — use N with view, delete

Each event gets a short numeric ID. Use these IDs with calendar view or calendar delete:

outlook-cli calendar view 1       # View full details of "Team Standup"
outlook-cli calendar delete 2     # Delete "Design Review"

If there are no events, prints: No events for "Today".

Example output (JSON):

outlook-cli calendar today --json
[
  {
    "id": "AAMkADAwATMw...",
    "subject": "Team Standup",
    "start": { "dateTime": "2026-01-15T09:00:00.0000000", "timeZone": "Pacific Standard Time" },
    "end": { "dateTime": "2026-01-15T09:30:00.0000000", "timeZone": "Pacific Standard Time" },
    "location": { "displayName": "Conference Room A" },
    "isAllDay": false,
    "organizer": { "emailAddress": { "name": "Alice", "address": "alice@example.com" } }
  }
]

calendar week

Show this week's events (Monday through Sunday of the current week).

outlook-cli calendar week
outlook-cli calendar week --timezone "Europe/London"
outlook-cli calendar week --json
Option Description Default
--timezone <tz> IANA timezone name. Affects week boundaries and event times. System timezone
--input <file> Load options from a JSON file.

Output format is the same as calendar today, grouped by day. Short IDs are assigned sequentially across all days:

── Monday, Jan 13 ──────────────────
#     Time             Subject                        Location
────────────────────────────────────────────────────────────────────────────
1     09:00 - 09:30    Team Standup                   Conference Room A

── Tuesday, Jan 14 ─────────────────
#     Time             Subject                        Location
────────────────────────────────────────────────────────────────────────────
2     10:00 - 11:00    Design Review                  Teams Meeting
3     14:00 - 15:00    1:1 with Manager               Manager's Office

── Wednesday, Jan 15 ───────────────
(no events)

3 event(s) — use N with view, delete

calendar range

Show events within a specific date range. Both --start and --end are required.

outlook-cli calendar range --start 2026-01-15 --end 2026-01-22
outlook-cli calendar range --start 2026-01-01 --end 2026-03-31 --json
outlook-cli calendar range --start 2026-01-15T09:00:00 --end 2026-01-15T17:00:00
Option Description Default
--start <date> Start date or datetime in ISO 8601 format. Examples: 2026-01-15, 2026-01-15T09:00:00. Required
--end <date> End date or datetime in ISO 8601 format. Required
--timezone <tz> IANA timezone name. System timezone
--input <file> Load options from a JSON file.

The range is inclusive of events that overlap with the specified window. A date without a time component is treated as midnight (start of day).


calendar view <eventId>

View full details of a specific calendar event, including attendees, body, and recurrence info. The eventId can be a short ID from the last today, week, or range command, or a full Microsoft Graph event ID.

outlook-cli calendar view 1                    # Short ID from last today/week/range
outlook-cli calendar view 1 --json             # Full event as JSON
outlook-cli calendar view AAMkADAwATMw...      # Full Graph ID (for scripts)
Option Description Default
--input <file> Load options from a JSON file.

Example output (text):

────────────────────────────────────────────────────────────
Subject:   Design Review
Start:     Wed, Jan 15, 2026, 10:00 AM
End:       Wed, Jan 15, 2026, 11:00 AM
Location:  Teams Meeting
Organizer: Alice Johnson <alice@example.com>
Attendees: bob@example.com (accepted), carol@example.com (tentative)
ID:        AAMkADAwATMw...
────────────────────────────────────────────────────────────
Please review the attached mockups before the meeting.

How to get the event ID: Use a short ID from the last listing command, or extract the full ID from JSON output for scripting:

outlook-cli calendar view 1                                   # Quick: use short ID
outlook-cli calendar today --json | jq -r '.[0].id'           # Script: extract full ID

calendar list-calendars

List all calendars available to the account. This includes the default calendar, shared calendars, and any calendars the user has subscribed to.

outlook-cli calendar list-calendars
outlook-cli calendar list-calendars --json
Option Description Default
--input <file> Load options from a JSON file.

Example output (text):

Calendar                       Owner                          ID
────────────────────────────────────────────────────────────────────────────
Calendar                       you@outlook.com                AAMkADAwATMw...
Holidays                       you@outlook.com                AAMkADAwATMw...
Shared Team Calendar           team@contoso.com               AAMkADAwATMw...

calendar create

Create a new calendar event. The event is created on the default calendar.

# Simple event
outlook-cli calendar create \
  --subject "Team Lunch" \
  --start "2026-01-20T12:00:00" \
  --end "2026-01-20T13:00:00" \
  --location "Cafeteria" \
  --yes

# Event with attendees
outlook-cli calendar create \
  --subject "Design Review" \
  --start "2026-01-20T14:00:00" \
  --end "2026-01-20T15:00:00" \
  --attendees "alice@example.com,bob@example.com" \
  --body "Please review the attached designs." \
  --yes

# HTML body from file
outlook-cli calendar create \
  --subject "Sprint Planning" \
  --start "2026-01-20T10:00:00" \
  --end "2026-01-20T11:30:00" \
  --body-file agenda.html \
  --yes

# From JSON template
outlook-cli calendar create --input event-template.json --yes --json
Option Description Default
--subject <text> Event subject / title. Required
--start <datetime> Start date/time in ISO 8601 format. Required
--end <datetime> End date/time in ISO 8601 format. Required
--timezone <tz> IANA timezone name for interpreting --start and --end. System timezone
--body <text> Event description / body text, inline.
--body-file <path> Read body from a file. Takes priority over --body. HTML auto-detected from .html/.htm extensions.
--body-content-type <type> Body content type: Text or HTML. Text
--location <text> Event location.
--attendees <emails> Attendee email addresses, comma-separated. Each receives a meeting invitation.
--yes Skip confirmation prompt. Prompt
--input <file> Load all parameters from a JSON file. CLI flags override JSON values.

Output: On success, prints the created event's ID and subject.


calendar delete <eventId>

Delete a calendar event. The eventId can be a short ID from the last today, week, or range command, or a full Microsoft Graph event ID.

outlook-cli calendar delete 2 --yes              # Short ID from last listing
outlook-cli calendar delete AAMkADAwATMw... --yes # Full Graph ID
Option Description Default
--yes Skip the "are you sure?" confirmation. Prompt
--input <file> Load options from a JSON file.

If the event is a recurring event, this deletes only the specific occurrence, not the entire series.


Common Workflows

Check today and view details

outlook-cli calendar today       # See today's events with short IDs
outlook-cli calendar view 1      # View full details of event 1

View the week and delete an event

outlook-cli calendar week        # See this week's events
outlook-cli calendar view 3      # Check details of event 3
outlook-cli calendar delete 3 --yes  # Cancel it

Multi-account calendar check

outlook-cli calendar today --account work      # List work events (IDs remember "work")
outlook-cli calendar today --account personal   # List personal events (IDs remember "personal")
outlook-cli calendar view 1                     # Views from whichever account listed event 1

Create an event from a template

// event-template.json
{
  "subject": "Weekly Sync",
  "start": "2026-01-20T10:00:00",
  "end": "2026-01-20T10:30:00",
  "timezone": "America/New_York",
  "attendees": "alice@example.com,bob@example.com",
  "location": "Teams Meeting",
  "body": "Standing weekly sync meeting"
}
outlook-cli calendar create --input event-template.json --yes