python-o365 icon indicating copy to clipboard operation
python-o365 copied to clipboard

Getting AttributeError: 'NoneType' object has no attribute 'get' when accessing calendar / events

Open RoterBaron01 opened this issue 2 years ago • 2 comments

Hey, I'm trying to read calendar events from multiple persons and get an error for an email that i try to read from. My code is something like this:

def get_calendar_entries_single(account_name, start, end, include_recurring = False, filter_options:dict) -> list[calendar.Event]:
    schedule = acc.schedule(resource=account_name)
    calendar = schedule.get_default_calendar()
    query = calendar.new_query('start').greater_equal(start).chain('and').on_attribute('end').less_equal(end)
    events = calendar.get_events(query=query, include_recurring=include_recurring)
    result = []
    for event in events:
        # dont care about this
        if event_filter(event, filter_options):
            result.append(event)
    return result

and I get an exception at for event in events: File "C:\Python310\lib\site-packages\O365\calendar.py", line 848, in __init__ self.__body = body.get(cc('content'), '') AttributeError: 'NoneType' object has no attribute 'get'

Do you have any idea why I get this error or is there a better way to get calendar events from another person?

RoterBaron01 avatar Mar 13 '23 21:03 RoterBaron01

I don't know I I can't replicate the error.

If you discover a bug please report and if possible send a PR.

thanks

alejcas avatar Apr 28 '23 10:04 alejcas

hey! most likely the calendar you are trying to access has a meeting marked as private.

jnwilbers avatar Sep 26 '23 07:09 jnwilbers