Skip to content

Unable to get event data from EventMessage using get_event() #683

@antti-ngp

Description

@antti-ngp

I'm looping through messages in mailbox and fetching event data for EventMessages like this:

for message in mailbox.get_messages():
            if message.is_event_message:
                event = message.get_event()
                print(f"Organizer: {event.organizer}")
                print(f"Start: {event.start}")
                print(f"End: {event.end}")
                print(f"Subject: {event.subject}")
                print(f"Attendees: {event.attendees}")

I'm expecting to see the event start and end times as well as the attendees etc. However, I'm only getting the event subject and nothing else:

Organizer:
Start: None
End: None
Subject: My event subject
Attendees: Attendees Count: 0

Looking at the code in message.py I think there's a bug on row 1038:

# select a dummy field (eg. subject) to avoid pull unneccesary data
query = self.q().select('subject').expand('event')

As the select('subject') restricts the fields fetched from the API and thus only the subject field contains data.

I tested removing the select('subject') from the row and got the expected results with attendees, start and end times etc:

Organizer: Antti Heikkilä
Start: 2021-09-10 12:30:00+00:00
End: 2021-09-10 13:00:00+00:00
Subject: My event subject
Attendees: Attendees Count: 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions