Skip to content

Commit bf8fe71

Browse files
Merge branch 'master' into master
2 parents d6084ac + 74e17ff commit bf8fe71

File tree

3 files changed

+40
-10
lines changed

3 files changed

+40
-10
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!

O365/message.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,4 +252,4 @@ def setBodyHTML(self, val=None):
252252
except:
253253
self.json['Body'] = {}
254254

255-
# To the King!
255+
# To the King!

examples/VehicleBookings/veh.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from O365 import *
2-
from printing import *
32
import json
43

54

@@ -15,25 +14,25 @@
1514
e = veh['email']
1615
p = veh['password']
1716

18-
schedule = Schedule(e,p)
17+
schedule = Schedule((e,p))
1918
try:
2019
result = schedule.getCalendars()
21-
print 'Fetched calendars for',e,'was successful:',result
20+
print('Fetched calendars for',e,'was successful:',result)
2221
except:
23-
print 'Login failed for',e
22+
print('Login failed for',e)
2423

2524
bookings = []
2625

2726
for cal in schedule.calendars:
28-
print 'attempting to fetch events for',e
27+
print('attempting to fetch events for',e)
2928
try:
3029
result = cal.getEvents()
31-
print 'Got events',result,'got',len(cal.events)
30+
print('Got events',result,'got',len(cal.events))
3231
except:
33-
print 'failed to fetch events'
34-
print 'attempting for event information'
32+
print('failed to fetch events')
33+
print('attempting for event information')
3534
for event in cal.events:
36-
print 'HERE!'
35+
print('HERE!')
3736
bookings.append(event.fullcalendarioJson())
3837
json_outs[e] = bookings
3938

0 commit comments

Comments
 (0)