Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

ConvertIdType class

The ConvertIdType class represents a request to convert item and folder identifiers between supported Exchange formats.

Namespace:  ExchangeWebServices
Assembly:  EWS (in EWS.dll)

public class ConvertIdType : BaseRequestType

The following example performs an identifier conversion between the Exchange Web Services identifier format and the Outlook Web Access identifier format.

static void ConvertId()
    // Set the version, credentials, and the Client Access server on ExchangeServiceBinding.
    ExchangeServiceBinding esb = new ExchangeServiceBinding();
    esb.RequestServerVersionValue = new RequestServerVersion();
    esb.RequestServerVersionValue.Version = ExchangeVersionType.Exchange2007_SP1;
    esb.Credentials = new NetworkCredential("username", "password", "domain");
    esb.Url = "https://FQDN/ews/exchange.asmx";

    // Create the request.
    ConvertIdType request = new ConvertIdType();
    request.SourceIds = new AlternateIdType[1];
    request.SourceIds[0] = new AlternateIdType();

    // Convert from the Exchange Web Services identifier to an Outlook Web Access identifier.
    request.SourceIds[0].Format = IdFormatType.EwsId;
    (request.SourceIds[0] as AlternateIdType).Id = "AAMkADk";
    (request.SourceIds[0] as AlternateIdType).Mailbox = "user@example.com";
    request.DestinationFormat = IdFormatType.OwaId;

        // Send the ConvertIdType request and get the response.
        ConvertIdResponseType response = esb.ConvertId(request);
        ArrayOfResponseMessagesType aormt = response.ResponseMessages;
        ResponseMessageType[] rmta = aormt.Items;

        // Check each response message.
        foreach (ConvertIdResponseMessageType resp in rmta)
            if (resp.ResponseClass == ResponseClassType.Success)
                ConvertIdResponseMessageType cirmt = (resp as ConvertIdResponseMessageType);
                AlternateIdType myId = (cirmt.AlternateId as AlternateIdType);

                string format = myId.Format.ToString();
                string identifier = myId.Id;
                string mailbox = myId.Mailbox;

                Console.WriteLine("Converted to format: {0}\r\nIdentifier: {1}\r\nMailbox: {2}", format, identifier, mailbox);
            else if (resp.ResponseClass == ResponseClassType.Error)
                Console.WriteLine("Error: " + resp.MessageText);
                Console.WriteLine("Warning: " + resp.MessageText);
    catch (Exception e)

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
© 2015 Microsoft