在 EWS 中扩展 属性

Extended property in EWS

我正在与 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>`

任何帮助将不胜感激!

谢谢

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

干杯 格伦