EWS - soap messages RRS feed

  • Question

  • Hii all :)

    I want to send a soap message to my exchange server ,

    can I  write this soap as i was writing below or I need add another  field  (e.g credential \ Exchange server name , ip ....) 

    <?xml version="1.0" encoding="utf-8" ?>
    <CreateItem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      <SavedItemFolderId xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
        <DistinguishedFolderId Id="sentitems" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" />
      <Items xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
        <Message xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
          <Subject>Daily Report</Subject>
          <Body BodyType="Text">(1) Handled customer issues, (2) Saved the world.</Body>
    Monday, April 9, 2012 12:31 PM


All replies

  • You also need a <soap:Envelope/>, a <soap:Body/>, and possibly a <soap:Header/> .  Typical example here:


    The request will need to be authenticated, using the credentials of the correct mailbox.

    Mobile OWA For Smartphone
    email a@t leederbyshire d.0.t c.0.m

    Tuesday, April 10, 2012 2:58 PM
  • And what about :

    EWS is described by three files:


    • "Services.wsdl   Describes the contract between client and server.
    • Messages.xsd   Defines the request and response SOAP messages.
    • Types.xsd   Defines the elements used in the SOAP messages.

    "These schema files are located in the IIS virtual directory that hosts Exchange Web Services of the computer that is running Microsoft Exchange Server that has the Client Access server role installed."

    Do I have to install these files in the IIS virtual directory (from where i get these files)

    and what a bout


    1. Enable access to Exchange Web Services for mailbox owners and/or EWS Managed API client applications.
    2. Reference the EWS Managed API assembly. 
    3. Validate X509 certificates for SSL over HTTP.
    4. Connect to Exchange Web Services by using the ExchangeService class.

    I don't understand what these steps mean ! can you help me?

    Saturday, April 14, 2012 7:18 AM
  • Those three files are used by your IDE to tell it how to help you build EWS applications.  Since you seem to be building and sending your SOAP requests manually, they aren't much use to you.  They are meant to be only in the EWS directory and nowhere else.  You point your IDE (if you use one) at it when you want to import the schema to your project.

    The second half of your question makes me think you approached EWS from the wrong angle.  If you are going to use the Managed API, then you don't get to build the SOAP messages yourself - the Managed API does it for you.  Are you in fact asking about starting an EWS Managed API from scratch?  Or are you really interested in sending SOAP messages some other way?

    Mobile OWA For Smartphone
    email a@t leederbyshire d.0.t c.0.m

    Monday, April 16, 2012 1:09 PM
  • Hi

    I want to send a soap message (that I manually build) to the exchange server , but I have a few questions about it 

    In MSDN when they write the EWS code they give a  webCredentials in the example. what I suppose to do if  I want to send directly the Soap message, Do I need to add this too? (if so, how can I do it?)

     // Connect to Exchange Web Services as user1 at contoso.com.
                   ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
                   service.Credentials = new WebCredentials("user1@contoso.com", "password ");
                   // Create the e-mail message, set its properties, and send it to user2@contoso.com, saving a copy to the Sent Items folder. 
                   EmailMessage message = new EmailMessage(service);

    Monday, April 16, 2012 2:52 PM
  • I don't think you can send your own soap messages when you are using the managed api.  I think you have to do something like this:


    in which case, the computer will just use the credentials of whoever is running the script (although you can assign others, if you want to).

    I don't think you can use the Managed API to send your own soap messages in the way you are trying.  The whole point of the API is that it does all that sort of manual work for you.  Unless you've seen an article describing a way to do it?

    Mobile OWA For Smartphone
    email a@t leederbyshire d.0.t c.0.m

    Monday, April 16, 2012 3:22 PM
  • I can send my own soap messages . I did it and it  works .

    But i have another question how can I change the attribut id ?:

    <t:ItemId  Id="ortalYTRlLTU2MDMtNDY3Yi04MjA4LWE1MzA1MTY1YjYzYwBGAAAAAACPm8YYZbLdR5PTSchM5ZHUBwBFDu1bzgfwRKZx+PgKy486AAAAabioAABFDu1bzgfwRKZx+PgKy486AAAAaqortal=" ChangeKey="DwAAABYAAABFDu1bzgfwRKZx+PgKy486AAAAortal" />  

    Thursday, May 3, 2012 2:13 PM
  • Hi,

    Resurrecting this old thread - Ortal, what did you use to send SOAP messages to EWS directly?

    Managed API sorts this out for you, but I have a similar requirement to yours so was wondering how you did this?


    Tuesday, November 11, 2014 3:17 AM