Skip to content

Commit

Permalink
Added location to satisfy issue googleapis#53.
Browse files Browse the repository at this point in the history
I don't actually have an account to test this with right now, so I'm not
sure if it will actually work.
  • Loading branch information
Toben Archer authored and Toben Archer committed Mar 2, 2017
1 parent 8197f03 commit 4ad428d
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions O365/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,4 +339,35 @@ def addAttendee(self,address,name=None):
name = address[:address.index('@')]
self.json['Attendees'].append({'EmailAddress':{'Address':address,'Name':name}})

def setLocation(self,loc):
'''
Sets the event's location.
Arguments:
loc -- two options, you can send a dictionary in the format discribed here:
https://msdn.microsoft.com/en-us/office/office365/api/complex-types-for-mail-contacts-calendar#LocationBeta
this will allow you to set address, coordinates, displayname, location email
address, location uri, or any combination of the above. If you don't need that much
detail you can simply send a string and it will be set as the locations display
name. If you send something not a string or a dict, it will try to cast whatever
you send into a string and set that as the display name.
'''
if Location not in self.json:
self.json['Location'] = {"Address":null}

if isinstance(loc,dict):
self.json['Location'] = loc
else:
self.json['Location']['DisplayName'] = str(loc)

def getLocation(self):
'''
Get the current location, if one is set.
'''
if Location in self.json:
return self.json['Location']
return None



#To the King!

0 comments on commit 4ad428d

Please sign in to comment.