none
ConvertId : how to convert an IMAP messageId to an OWA id? RRS feed

All replies

  • You can't that ID is assigned by the MTA (or sending client) and doesn't really have anything to do with the Exchange Store the best you will be able to do is search for the message first using EWS then just use the WebClientReadorFormQueryString which will give you the properly format OWA url eg

                String MessageID = "<59f947de-1823-48fb-b818-8f57adec39b3@tk5-exhub-e801.partners.extranet.microsoft.com>";
                ItemView ivew = new ItemView(1);
                ExtendedPropertyDefinition PidTagInternetMessageId = new ExtendedPropertyDefinition(4149, MapiPropertyType.String);
                ExtendedPropertyDefinition exProp = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Common, 34070, MapiPropertyType.SystemTime);
                SearchFilter sf = new SearchFilter.IsEqualTo(PidTagInternetMessageId, MessageID);
                FindItemsResults<Item> iCol = service.FindItems(WellKnownFolderName.Inbox, sf, ivew);
    
                foreach (Item item in iCol.Items)
                {
    
                    Console.WriteLine(item.WebClientReadFormQueryString);
                }
    Cheers
    Glen
    Wednesday, February 15, 2012 9:32 AM
  • Hi Glen

    In Exchange 2003 I used to fetch the email URL by sending the messageId in a WebDAV request.

    (But I see that WebDAV is getting deprecated in later versions.)  Is there any other way I can get the http url of an email using IMAP MessageId alone?

    Wednesday, February 15, 2012 11:01 AM
  • >In Exchange 2003 I used to fetch the email URL by sending the messageId in a WebDAV request.

    EWS is what replaces WebDAV the code i posted above would do the same thing that WebDAV would you may actually find it better to rewrite whatever you doing with IMAP to use EWS as this is a more fully featured API.

    Cheers
    Glen
    Thursday, February 16, 2012 4:31 AM
  • I tired this code sample with a Exchange 2007 SP1,  and got this

    microsoft.exchange.webservices.data.ServiceVersionException: The property null is valid only for Exchange Exchange2010 or later versions.
     at microsoft.exchange.webservices.data.PropertyBag.getPropertyValueOrException
     at microsoft.exchange.webservices.data.PropertyBag.getObjectFromPropertyDefinition
     at microsoft.exchange.webservices.data.Item.getWebClientReadFormQueryString

    "WebClientReadFormQueryString" is what is causing the issue.

    I am developing a POC,  so for now  I am planning to do something  like this

    for (Item item : iCol.getItems())
         {
             ItemId itd = item.getId().getUniqueId();
             String convertedId = service.convertId(..) //another call to convert from EwsId to OwaId
        }	 

    Note: I tried this using java api (http://archive.msdn.microsoft.com/ewsjavaapi ) , but I think the behaviour will be the same in C# too..

    Thursday, February 16, 2012 8:40 AM