11import base64
22import mimetypes
33import requests
4+ import json
45from microsoftgraph import exceptions
56from microsoftgraph .decorators import token_required
67from urllib .parse import urlencode , urlparse , quote_plus
@@ -297,8 +298,7 @@ def get_me_events(self):
297298
298299 @token_required
299300 def create_calendar_event (self , subject , content , start_datetime , start_timezone , end_datetime , end_timezone ,
300- recurrence_type , recurrence_interval , recurrence_days_of_week , recurrence_range_type ,
301- recurrence_range_startdate , recurrence_range_enddate , location , attendees , calendar = None ):
301+ location , calendar = None , ** kwargs ):
302302 """
303303 Create a new calendar event.
304304
@@ -309,18 +309,6 @@ def create_calendar_event(self, subject, content, start_datetime, start_timezone
309309 start_timezone: in the format of Pacific Standard Time, string
310310 end_datetime: in the format of 2017-09-04T11:00:00, dateTimeTimeZone string
311311 end_timezone: in the format of Pacific Standard Time, string
312- recurrence_type: daily, weekly, absoluteMonthly, relativeMonthly, absoluteYearly, relativeYearly
313- recurrence_interval: The number of units between occurrences, can be in days, weeks, months, or years,
314- depending on the type. Required.
315- recurrence_days_of_week: sunday, monday, tuesday, wednesday, thursday, friday, saturday
316- recurrence_range_type: endDate, noEnd, numbered
317- recurrence_range_startdate: The date to start applying the recurrence pattern. The first occurrence of the
318- meeting may be this date or later, depending on the recurrence pattern of the
319- event. Must be the same value as the start property of the recurring event.
320- Required.
321- recurrence_range_enddate: Required if type is endDate, The date to stop applying the recurrence pattern.
322- Depending on the recurrence pattern of the event, the last occurrence of the
323- meeting may not be this date.
324312 location: string
325313 attendees: list of dicts of the form:
326314 {"emailAddress": {"address": a['attendees_email'],"name": a['attendees_name']}
@@ -330,13 +318,14 @@ def create_calendar_event(self, subject, content, start_datetime, start_timezone
330318 A dict.
331319
332320 """
333- attendees_list = [{
334- "emailAddress" : {
335- "address" : a ['attendees_email' ],
336- "name" : a ['attendees_name' ]
337- },
338- "type" : a ['attendees_type' ]
339- } for a in attendees ]
321+ # TODO: attendees
322+ # attendees_list = [{
323+ # "emailAddress": {
324+ # "address": a['attendees_email'],
325+ # "name": a['attendees_name']
326+ # },
327+ # "type": a['attendees_type']
328+ # } for a in kwargs['attendees']]
340329 body = {
341330 "subject" : subject ,
342331 "body" : {
@@ -351,22 +340,10 @@ def create_calendar_event(self, subject, content, start_datetime, start_timezone
351340 "dateTime" : end_datetime ,
352341 "timeZone" : end_timezone
353342 },
354- "recurrence" : {
355- "pattern" : {
356- "type" : recurrence_type ,
357- "interval" : recurrence_interval ,
358- "daysOfWeek" : recurrence_days_of_week
359- },
360- "range" : {
361- "type" : recurrence_range_type ,
362- "startDate" : recurrence_range_startdate ,
363- "endDate" : recurrence_range_enddate
364- }
365- },
366343 "location" : {
367344 "displayName" : location
368345 },
369- "attendees" : attendees_list
346+ # "attendees": attendees_list
370347 }
371348 url = 'me/calendars/{}/events' .format (calendar ) if calendar is not None else 'me/events'
372349 return self ._post (self .base_url + url , json = body )
0 commit comments