Search code examples
pythonexchangelib

How to get the original recipient of a MeetingRequest using Python exchangelib?


The scenario

In our scenario we have:

Resource mailboxes are setup so that their meeting requests are forwarded to the manager mailbox. The manager will accept or decline on behalf of the resource.

Our python script connects to the manager account using exchangelib, get the meeting requests and is supposed to accept or to decline depending on rules that are resource specific.

The problem

Our problem is that we can't find a way to know which resource is a MeetingRequest related to.

What we have tried so far

The to_recipients field's value is [email protected] so it doesn't help.

The author and sender fields' values are the mailbox which has created the original meeting so it doesn't help either.

We can't rely upon required_attendees or optional_attendees for 2 reasons:

  1. There always are peoples' email addresses in the attendees in addition to the resource and our script can't differentiate a resource email address from other email addresses.
  2. There can be more than one resource for the same meeting. In such a case there will be a meeting request for each resource, each with all the resources in the attendees.

According to MS doc MeetingRequest should have a ReceivedRepresenting field which seems to be exactly what we need. Unfortunately it is not present in the exchangelib MeetingRequest object although it is in the XML response from EWS when getting the meeting request (we can see it by unabling exchangelib debug logging).

<t:ReceivedRepresenting>
    <t:Mailbox>
        <t:Name>Resource A</t:Name>
        <t:EmailAddress>[email protected]</t:EmailAddress>
        <t:RoutingType>SMTP</t:RoutingType>
        <t:MailboxType>Mailbox</t:MailboxType>
    </t:Mailbox>
</t:ReceivedRepresenting>

Any idea?

Any idea on how to solve this?


Solution

  • ReceivedRepresenting is not mentioned in the EWS documentation on MeetingRequest Does your MeetingRequest XML element contain such a child element? If it does, then please open an issue at ecederstrand/exchangelib and I'll have the field implemented.

    UPDATE: I've opened a pull request against EWS docs to have this field added. And committed a change to support the field in exchangelib. It's released in v4.7.2.