none
Direct link to email in Outlook Web App - URL encoding inconsistency RRS feed

  • Question

  • Hello,

    I am constructing a direct link to open an email in Outlook Web App by passing in the email ID in a query string: https://outlook.office365.com/owa/#ItemID=[emailID]

    The email ID is retrieved from the Office 365 JavaScript API. I have noticed there is a mismatch between the successful email ID and email ID retrieved from the API.

    For example:

    Here is the email ID that successfully links to the email:

    AAMkAGM0NjU5M2I2LWM4ODQtNDZlMC04OTY1LTJhZjZmNGY5OTdiYwBGAAAAAADeLzO0mjrSSob7RZoNpXshBwBH3pEHtE0FT43EZewVWmsMAAAAAAENAABH3pEHtE0FT43EZewVWmsMAACS%2FgzeAAA%3D

    Here is the email ID retrieved from the API:

    AAMkAGM0NjU5M2I2LWM4ODQtNDZlMC04OTY1LTJhZjZmNGY5OTdiYwBGAAAAAADeLzO0mjrSSob7RZoNpXshBwBH3pEHtE0FT43EZewVWmsMAAAAAAENAABH3pEHtE0FT43EZewVWmsMAACS-gzeAAA=

    The difference is, the '-' is being encoded as '%2F', when '%2F' should be the encoding for a '/' 

    Is there any explanation to why Microsoft encodes '-' to '%2F' on their end?

    Thanks

    Wednesday, June 18, 2014 4:57 PM

Answers

  • Lance,

    The REST API does replace '/' with '-', and also replaces '+' with '_'. The reason they do this is to make the base 64 string "URL safe", similar to what is described in RFC3548 section 4. So before using REST ids in EWS or to build an OWA URL, you should do a replace on those two characters.

    Hope that helps!

    Jason

    Tuesday, June 24, 2014 5:57 PM

All replies

  • Hi Lance,

    Can you clarify if the API you're referring to is the Item.itemId property in the JavaScript API for Office, or some other Office 365 API please?

    Angelgolfer

    Thursday, June 19, 2014 12:52 AM
    Answerer
  • Hi Angelgolfer,

    Thanks for the reply. The API I'm working with is the Office 365 REST API: http://msdn.microsoft.com/en-us/library/office/dn605896(v=office.15).aspx

    Sorry for the confusion


    Thursday, June 19, 2014 2:36 PM
  • Hi Lance,

    Thanks for the reply. Still drilling down on the exact Rest API you used to get the email ID - was that email already existing in the folder and did you do a get for emails in that folder to get that email ID? Or did you use the REST API to create the email, which returned you the email ID?

    With your further information, I will try to contact the related product team to look into this. Thank you for your patience.

    Angelgolfer

    Senior Content Developer

    Thursday, June 19, 2014 9:05 PM
    Answerer
  • The email was already existing in the inbox folder, and I did a get for emails in that folder to retrieve the email ID.

    Thanks

    Friday, June 20, 2014 2:22 PM
  • Lance,

    The REST API does replace '/' with '-', and also replaces '+' with '_'. The reason they do this is to make the base 64 string "URL safe", similar to what is described in RFC3548 section 4. So before using REST ids in EWS or to build an OWA URL, you should do a replace on those two characters.

    Hope that helps!

    Jason

    Tuesday, June 24, 2014 5:57 PM