From b46415b8d91611289e3207217ba039394dc6c40f Mon Sep 17 00:00:00 2001 From: Tim Bendt Date: Mon, 7 Jul 2025 11:50:16 -0400 Subject: [PATCH] fixed cal downloads --- src/cli/sync.py | 5 ++++- src/services/microsoft_graph/calendar.py | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/cli/sync.py b/src/cli/sync.py index c4556d7..52a1592 100644 --- a/src/cli/sync.py +++ b/src/cli/sync.py @@ -182,6 +182,9 @@ async def fetch_calendar_async(headers, progress, task_id, dry_run, vdir_path, i async def _sync_outlook_data(dry_run, vdir, icsfile, org, days_back, days_forward, continue_iteration, download_attachments): """Synchronize data from external sources.""" + # Expand the user home directory in vdir path + vdir = os.path.expanduser(vdir) + # Save emails to Maildir maildir_path = ( os.getenv("MAILDIR_PATH", os.path.expanduser( @@ -265,7 +268,7 @@ async def _sync_outlook_data(dry_run, vdir, icsfile, org, days_back, days_forwar "--days-forward", type=int, help="Number of days to look forward for calendar events", - default=6, + default=30, ) @click.option( "--continue-iteration", diff --git a/src/services/microsoft_graph/calendar.py b/src/services/microsoft_graph/calendar.py index ca92db3..0925daa 100644 --- a/src/services/microsoft_graph/calendar.py +++ b/src/services/microsoft_graph/calendar.py @@ -40,7 +40,7 @@ async def fetch_calendar_events( calendar_url = ( f"https://graph.microsoft.com/v1.0/me/calendarView?" f"startDateTime={start_date_str}&endDateTime={end_date_str}&" - f"$select=id,subject,organizer,start,end,location,isAllDay,showAs,sensitivity" + f"$select=id,subject,organizer,start,end,location,isAllDay,showAs,sensitivity&$count=true" ) events = [] @@ -57,4 +57,5 @@ async def fetch_calendar_events( next_link = response_data.get("@odata.nextLink") # Return events and total count - return events, len(events) + total_count = response_data.get("@odata.count", len(events)) + return events, total_count