O365 / python-o365

A simple python library to interact with Microsoft Graph and Office 365 API
Apache License 2.0
1.66k stars 421 forks source link

How to schedule a shared event? #787

Open bhav09 opened 2 years ago

bhav09 commented 2 years ago

Hi @janscas O365 package is really helpful and I have been using it to develop a service where I am trying to schedule a shared event but from the readme I have been able to find scheduler for personal events only. I am sharing the code that I am referring for personal events.

from datetime import datetime as dt
# necessary imports  and credentials

credentials = (CLIENT_ID, SECRET_ID)
protocol = MSGraphProtocol()

protocol = MSGraphProtocol(defualt_resource='<sharedcalendar@domain.com>')
scopes = ['Calendars.Read.Shared','Calendars.ReadWrite.Shared']
account = Account(credentials, protocol=protocol)

if account.authenticate(scopes=scopes):
   print('Authenticated!')

schedule = account.schedule()
calendar = schedule.get_default_calendar()
new_event = calendar.new_event()
new_event.subject = 'Test Event'
new_event.location = 'No location'

new_event.start = dt(2022, 6, 6, 16, 45)
new_event.start = dt(2022, 6, 6, 17, 0)

new_event.remind_before_minutes = 15

new_event.save()

Can you help me understanding how can I schedule shared events on Outlook via 0365. Thanks 😊

alejcas commented 2 years ago

I don't really know... Take a look at the MS Graph docs and try to find something about shared events. If it's in MS Graph it's possible to implement in O365.

Thanks

bhav09 commented 2 years ago

Thanks! If I am stuck in anything else, will query back here :)

yeyeric commented 1 year ago

did you find a way @bhav09 ?