3
votes

I'm trying to use the CreateItem function of Exchange Web Services for Exchange 2010 as per http://msdn.microsoft.com/en-us/library/exchange/aa566468%28v=exchg.140%29.aspx to create a message. No matter what I do, the messages always appear in Outlook as drafts. Here is the XML I am sending:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
  <soap:Header>
    <t:RequestServerVersion Version="Exchange2010_SP1"/>
  </soap:Header>
  <soap:Body>
    <CreateItem MessageDisposition="SaveOnly" xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
      <SavedItemFolderId>
        <t:FolderId ChangeKey="..." Id="..."/>
      </SavedItemFolderId>
      <Items>
        <t:Message>
          <t:MimeContent CharacterSet="UTF-8">BASE64 ENCODED MESSAGE</t:MimeContent>
          <t:ItemClass>IPM.Note</t:ItemClass>
          <t:Subject>THE SUBJECT LINE</t:Subject>
          <t:Sensitivity>Normal</t:Sensitivity>
          <t:Importance>Normal</t:Importance>
          <t:Culture>en-US</t:Culture>
          <t:IsRead>true</t:IsRead>
        </t:Message>
      </Items>
    </CreateItem>
  </soap:Body>
</soap:Envelope>

I've tried adding a <t:IsDraft>false</t:IsDraft> to the <t:Message/> but it appears that isn't allowed.

3
Please post the rest of your code which then interacts with the Message item..specifically the section dealing with the WebService and the MessageItemainesophaur
That's not going to be useful. It's Perl, and I wrote it using LibXML and LWP. I'm not using the C# managed API or any other well known library. The above XML is POSTed, and correctly creates the message. The problem is, when viewing it in Outlook the message appears as a draft.Mike Cardwell

3 Answers

0
votes

Late to the game, but we had this and it was due to insufficient storage on the Exchange machine.

0
votes

If you don't specify the PR_MESSAGE_FLAGS extended property on your CreateItem request, it defaults to MSGFLAG_UNSENT | MSGFLAG_UNMODIFIED (decimal 10). In other words, an unread, unmodified draft.

The initial values for this property are typically MSGFLAG_UNSENT
and MSGFLAG_UNMODIFIED to indicate a message that has not yet been
sent or changed. When a message is saved for the second time, the
message store provider clears the MSGFLAG_UNMODIFIED flag.

If you add the following to your request's <Message>, you'll instead be creating a read non-draft:

  <t:ExtendedProperty> 
    <t:ExtendedFieldURI PropertyTag="3591" PropertyType="Integer" /> 
    <t:Value>1</t:Value> 
  </t:ExtendedProperty>

(The extended property's Value of 1 means MSGFLAG_READ.)

-1
votes

Way late, but this came up in a search for me today.

MessageDisposition controls whether it's a draft. You have <CreateItem MessageDisposition="SaveOnly", needs to be <CreateItem MessageDisposition="SendAndSaveCopy"