Skip to content

Commit

Permalink
Change top to 400
Browse files Browse the repository at this point in the history
  • Loading branch information
PhongT16 committed Nov 9, 2023
1 parent 696acc8 commit b99a463
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion IndividualCalendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,5 +206,5 @@ def process_individual_calendars(calendar, start_date, end_date):
except KeyError as e:
logger.warning(f"Unable to find: " + net_id)

# filtered_events = []
#filtered_events = []
return filtered_events
4 changes: 3 additions & 1 deletion SharedCalendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def get_shared_calendar(shared_calendar_id, start_date, end_date, access_token):
# start between start_date and end_date (includes start_date)
# The exception is if the event start on the end_date. That event will not be included in the response.json()

endpoint = 'https://graph.microsoft.com/v1.0/me/calendars/' + shared_calendar_id +'/events?$select=subject,body,start,end,showAs&$top=100&$filter=start/dateTime ge ' + '\''+ start_date + '\'' + ' and start/dateTime lt ' + '\'' + end_date + '\''
endpoint = 'https://graph.microsoft.com/v1.0/me/calendars/' + shared_calendar_id +'/events?$select=subject,body,start,end,showAs&$top=400&$filter=start/dateTime ge ' + '\''+ start_date + '\'' + ' and start/dateTime lt ' + '\'' + end_date + '\''
response = requests.get(endpoint, headers=header)

if (response.status_code != 200):
Expand Down Expand Up @@ -144,6 +144,8 @@ def update_shared_calendar(individual_calendars, shared_calendar, event_ids, sha
events_to_add = individual_events.difference(shared_events)
events_to_delete = shared_events.difference(individual_events)


logger.debug(f"Number of events to be added: {len(events_to_add)}")
batches = create_batches_for_adding_events(events_to_add, access_token, shared_calendar_id, category_name, category_color)
post_batch(access_token, batches)

Expand Down

0 comments on commit b99a463

Please sign in to comment.