Search code examples
exchangewebservices

Exchange EWS ID conversion


I am trying to build an EWS (via SOAP - it's a PHP app, no .net!) application that looks up the appointments of an arbitrary user and then looks up, if possible, the appointment details.

I use the GetUserAvailability call and get CalendarEvents back from it. So far so good, for events where I have view permission in Outlook too I get a CalendarEventDetails block inside the CalendarEvent. The ID however is nothing I can use in a subsequent GetItem call:

  • ID from CalendarEventDetails: 00000000D18EFE3E27D8FA498176E18417AF9E590700B2A9C65B63B7D74B9028423C9EEB4F6800000000010D0000B2A9C65B63B7D74B9028423C9EEB4F6800008765890B0000
  • ID from the CalendarItem retrieved by a FindItem call (on the Calendar folder of the target user): AAMkAGM5ODcxMzhjLTRkMGYtNDVmNC1iOTc5LTMyNWIyZTJhNWVjZABGAAAAAADRjv4+J9j6SYF24YQXr55ZBwCyqcZbY7fXS5AoQjye609oAAAAAAENAACyqcZbY7fXS5AoQjye609oAACHZYkLAAA=

When I base64-decrypt the FindItem ID and convert it to hex, the FindItem id seems to consist of some header, a UUID and the ID from CalendarEventDetails.

What do I need to do to use a CalendarEventDetails ID with a GetItem call?


Solution

  • 00000000D18EFE3E27D8FA498176E18417AF9E590700B2A9C65B63B7D74B9028423C9EEB4F6800000000010D0000B2A9C65B63B7D74B9028423C9EEB4F6800008765890B0000

    This Id is the HexEntryId of the calendar appointment so it needs to be converted to an EWSId using the ConvertId operation in EWS https://msdn.microsoft.com/en-us/library/office/bb799665(v=exchg.150).aspx . You will need to convert from Type HexEntryId to EWSid eg

     <?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
        <soap:Header>
          <t:RequestServerVersion Version="Exchange2010_SP2" />
        </soap:Header>
        <soap:Body>
          <m:ConvertId DestinationFormat="EwsId">
            <m:SourceIds>
              <t:AlternateId Format="HexEntryId" Id="00000000D18EFE3E27D8FA498176E18417AF9E590700B2A9C65B63B7D74B9028423C9EEB4F6800000000010D0000B2A9C65B63B7D74B9028423C9EEB4F6800008765890B0000" Mailbox="user@domain.com" />
            </m:SourceIds>
          </m:ConvertId>
        </soap:Body>
      </soap:Envelope>