[E2013] [EWS] [Other] Problem with create a link to an email inside public folder. RRS feed

  • Question

  • My application connects to EWS and reads all messages in mailbox. I can convert EWSId to HexEntryId using ConvertId operation and use HexEntryId to create html link to the message.

    <a href=”Outlook: HexEntryId”>Link to Message</a>

    This link works perfect, outlook automatically opens message in new window. Problem starts when I move message to public folder.  

    First think I noticed that message id is different every time I move message from mailbox to public folder.

    Problem #1

    Ok, let’s convert Id to HEX (as I described above),

    When I try to convert new EWSId (message from public folder) to HexEntryId I get an error “This id is of the wrong type for this conversion operation (mailbox id vs. public folder id).”

    I researched my problem and found solution. To convert pubic folder EWSId I had to user Alternative Public Folder Item Id Type in ConvertId operation.

    Perfect, It worked, now I have new HexEntryId. Let’s build link to message now.

    Problem #2

    <a href=”Outlook: HexEntryId”>Link to Message</a> - link doesn’t work anymore.

    I spend hours trying to found any information online, but there is nothing about links to items in public folders.

    I’m, able to create working links to message in mailbox and link to open public folder locations. But I can’t find solution how to open message from public folder.

    Is anyone know if this is even possible, or maybe know how to do this? 

    Saturday, March 5, 2016 11:05 PM

All replies

  • If you compare the PR_Entryd Id property  you can get when you using a Mapi Editor like Outlookspy of MfcMapi to look at the public folder item to the Id you get from ConvertId are they the same ? if that aren't If you cut and paste the Id from the Mapi editor does that work ?


    Monday, March 7, 2016 6:22 AM
  • Hi Glen, thanks for help

    I checked EntryId using OutlookSpy and id is different and link works now. 

    Converter id from EWS: 


    Id from OutlookSpy: 


    first 42 characters are different, the rest is the same. 

    Now my question is how can I get this id using EWS API. What operation should I use to convert EWS?

    • Edited by Gypsy1125 Monday, March 7, 2016 2:19 PM
    Monday, March 7, 2016 2:09 PM
  • I think I found the solution. 

    Every time when you convert EwsId To HexEntryId you have to replace first 42 characters with "000000001A447390AA6611CD9BC800AA002FC45A09"

    see: https://msdn.microsoft.com/en-us/library/office/bb799665(v=exchg.150).aspx

    The ConvertId operation does not work as expected when converting public folder identifiers from the EWS identifier to the store identifier in Exchange Online and Exchange 2013. You can manually update the identifier that is returned as a workaround. To manually update the identifier:

    1. In your application code, determine whether the target item/folder is in a public folder.

    2. Decode the Base64-encoded identifier string.

    3. Verify that the type byte (21st byte) has a value of 7. A value of 7 indicates that the identifier is in the incorrect format.

    4. Skip the first four bytes. They must be set to zero.

    5. Update the next 16 bytes with the following GUID: 1A447390AA6611CD9BC800AA002FC45A

    6. Update the next byte (type byte) with a value of 9.

    7. Change the identifier to a Base64-encoded string

    • Edited by Gypsy1125 Monday, March 7, 2016 3:33 PM
    Monday, March 7, 2016 3:33 PM