EWS 中的扩展属性



我正在与交易所交互以提取具有特定扩展属性的电子邮件。我能够获取使用新创建的扩展属性发送的电子邮件,但是当我回复电子邮件时,这些属性不会保留。这是正常行为吗?有没有办法解决它?

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

发送具有扩展属性的电子邮件

`<?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,引用或对话 ID,例如 http://blog.mailgun.com/tracking-replies-in-mailgun-or-any-other-email/

干杯幽谷

相关内容

  • 没有找到相关文章

最新更新