Skip to content

Commit 4ad428d

Browse files
Toben ArcherToben Archer
authored andcommitted
Added location to satisfy issue googleapis#53.
I don't actually have an account to test this with right now, so I'm not sure if it will actually work.
1 parent 8197f03 commit 4ad428d

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

O365/event.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,4 +339,35 @@ def addAttendee(self,address,name=None):
339339
name = address[:address.index('@')]
340340
self.json['Attendees'].append({'EmailAddress':{'Address':address,'Name':name}})
341341

342+
def setLocation(self,loc):
343+
'''
344+
Sets the event's location.
345+
346+
Arguments:
347+
loc -- two options, you can send a dictionary in the format discribed here:
348+
https://msdn.microsoft.com/en-us/office/office365/api/complex-types-for-mail-contacts-calendar#LocationBeta
349+
this will allow you to set address, coordinates, displayname, location email
350+
address, location uri, or any combination of the above. If you don't need that much
351+
detail you can simply send a string and it will be set as the locations display
352+
name. If you send something not a string or a dict, it will try to cast whatever
353+
you send into a string and set that as the display name.
354+
'''
355+
if Location not in self.json:
356+
self.json['Location'] = {"Address":null}
357+
358+
if isinstance(loc,dict):
359+
self.json['Location'] = loc
360+
else:
361+
self.json['Location']['DisplayName'] = str(loc)
362+
363+
def getLocation(self):
364+
'''
365+
Get the current location, if one is set.
366+
'''
367+
if Location in self.json:
368+
return self.json['Location']
369+
return None
370+
371+
372+
342373
#To the King!

0 commit comments

Comments
 (0)