EWS的扩展财产

时间:2016-02-15 22:48:44

标签: email soap exchangewebservices extended-properties

我正在与Exchange交互以提取具有特定扩展属性的电子邮件。我能够通过新创建的扩展属性获取我发送的电子邮件,但是当我回复电子邮件时,这些属性不会保留。这是正常的行为吗?无论如何要解决它吗?

我现在用来发送和获取电子邮件的代码如下所示

发送包含扩展属性的电子邮件

`<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
      xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
      xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <t:RequestServerVersion Version="Exchange2010" />
  </soap:Header>
  <soap:Body>
    <m:CreateItem MessageDisposition="SendAndSaveCopy">
      <m:SavedItemFolderId>
        <t:DistinguishedFolderId Id="sentitems" />
      </m:SavedItemFolderId>
      <m:Items>
        <t:Message>
          <t:Subject>Greetings</t:Subject>
          <t:Body BodyType="Text">Message with extended property attached</t:Body>
          <t:ExtendedProperty>
            <t:ExtendedFieldURI PropertySetId="c11ff724-aa03-4555-9952-8fa248a11c3e"
              PropertyName="extended_property_name" PropertyType="String" />
            <t:Value>NEWVALUE</t:Value>
          </t:ExtendedProperty>
          <t:ToRecipients>
            <t:Mailbox>
              <t:EmailAddress>test@cisco.com</t:EmailAddress>
            </t:Mailbox>
          </t:ToRecipients>
        </t:Message>
      </m:Items>
    </m:CreateItem>
  </soap:Body>
</soap:Envelope>`

使用扩展属性获取电子邮件

`<?xml version="1.0" encoding="UTF-8" ?>
<soapenv:Envelope
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:typ="http://schemas.microsoft.com/exchange/services/2006/types"
    xmlns:mes="http://schemas.microsoft.com/exchange/services/2006/messages">
    <soapenv:Header>
        <typ:RequestServerVersion Version="Exchange2007_SP1"/>
    </soapenv:Header>
    <soapenv:Body>
        <mes:FindItem Traversal="Shallow">
            <mes:ItemShape>
                <typ:BaseShape>Default</typ:BaseShape>
                <typ:IncludeMimeContent>false</typ:IncludeMimeContent>
                <typ:BodyType>Best</typ:BodyType>
            </mes:ItemShape>
            <mes:IndexedPageItemView MaxEntriesReturned="10" Offset="0" BasePoint="Beginning"/>
         <mes:GroupBy Order="Ascending">
            <typ:FieldURI FieldURI="item:DateTimeReceived" />         
            <typ:AggregateOn Aggregate="Maximum">
               <typ:FieldURI FieldURI="item:ItemId"/> 
            </typ:AggregateOn>
         </mes:GroupBy> 
            <mes:Restriction>
                    <typ:IsEqualTo>
                        <typ:ExtendedFieldURI PropertySetId="c11ff724-aa03-4555-9952-8fa248a11c3e" PropertyName="extended_property_name" PropertyType="String" />
                        <typ:FieldURIOrConstant>
                            <typ:Constant Value="NEWVALUE" />
                        </typ:FieldURIOrConstant>
                    </typ:IsEqualTo>
            </mes:Restriction>
            <mes:ParentFolderIds>
                <!--You have a CHOICE of the next 2 items at this level-->
                <typ:FolderId Id="[Process.Variables.Completed Id]" 
            ChangeKey="[Process.Variables.Completed ChangeKey]"/>
            </mes:ParentFolderIds>
        </mes:FindItem>
    </soapenv:Body>
</soapenv:Envelope>`

非常感谢任何帮助!

由于

1 个答案:

答案 0 :(得分:0)

是的,您的设置对于您发送的邮件的扩展属性是正常的,响应是一条全新的邮件,并且不会包含您设置的任何自定义属性(如果这样做,这实际上会更有问题) 。如果您尝试关联响应并回复,那么您应该查看InReplyto,Referances或ConversationId,例如http://blog.mailgun.com/tracking-replies-in-mailgun-or-any-other-email/

欢呼声 格伦