我想向我的应用程序中的消息添加自定义扩展属性。这就是我的方法:
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:mes="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:typ="http://schemas.microsoft.com/exchange/services/2006/types">
<soap:Header>
<typ:RequestServerVersion Version="Exchange2010_SP2" />
</soap:Header>
<soap:Body>
<mes:CreateItem MessageDisposition="SendAndSaveCopy">
<mes:SavedItemFolderId>
<typ:DistinguishedFolderId Id="sentitems" />
</mes:SavedItemFolderId>
<mes:Items>
<typ:Message>
<typ:Subject />
<typ:Body BodyType="Text">-----BEGIN No.1 BC Mail MESSAGE-----
Version: No.1 BC Mail
wcBMA9EUSdwBcz5fAQf9FunNo+meJ5vHeHWVGzF8uyhFiRrEoLpFTQapkB6Lv0F3lqRc7lw9msQ/
dFgtlfPb0yZogodnhoxPvYDsNyZYGsvmsrqhJg3jqIVt1Kz4rlP6dhsjgOqPWbmLjRhLry37zVrC
J5dJo8bVn6XbGoorJEhDcS1iBOICsTrQk58GbOD6PIbSgCbdBqpxoJD/9kxyKVWN6iIZ5f37fsJX
mDtUTLGjKwggW5b4GWdCyhZdIPJfIVRvhkGfOBeDH0miXLeNJtkbRDYpXYt9JJgPc2pOlzYl7gfj
5PDaMmry/TIZczYuxzs+k8Mfi4NlrU3OWyujtNlDMAFvtDQQW5Fxbc/IwdJMAeh3LQc0LEXZ1JHt
3OQf8yUOvpOGLpmS3y9yKIx9Lsfs6y3iHuigid8PoBcHtqes9UKJhMa/XN0sWme4sKT0EThr8dmZ
1RzRtOgUaQ==
=NVmA
-----END No.1 BC Mail MESSAGE-----</typ:Body>
<typ:ExtendedProperty>
<typ:ExtendedFieldURI PropertySetId="36603a56-9a21-4e9d-b4b7-6eb13876716a" PropertyName="OriginalId" PropertyType="String" />
<typ:Value>E8C6AC72-7768-4EA7-BABC-CD3CBED619CC</typ:Value>
</typ:ExtendedProperty>
<typ:ToRecipients>
<typ:Mailbox>
<typ:EmailAddress>ach@iibo.biz</typ:EmailAddress>
</typ:Mailbox>
</typ:ToRecipients>
<typ:From>
<typ:Mailbox>
<typ:EmailAddress>910024@iibo.biz</typ:EmailAddress>
</typ:Mailbox>
</typ:From>
</typ:Message>
</mes:Items>
</mes:CreateItem>
</soap:Body>
</soap:Envelope>
然后从Sent Items
文件夹中获得新创建的消息:
<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" MajorVersion="15" MinorVersion="0" MajorBuildNumber="1365" MinorBuildNumber="1" Version="V2_23" />
</s:Header>
<s:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<m:GetItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<m:ResponseMessages>
<m:GetItemResponseMessage ResponseClass="Success">
<m:ResponseCode>NoError</m:ResponseCode>
<m:Items>
<t:Message>
<t:ItemId Id="AAMkADE3MTJkZWNlLTZiYWYtNDY4Yi1hNmM3LWU2MzY2ZDZjYWNhMQBGAAAAAACoXti5FFu8TJNLLS5k9vC8BwAcJDq8WkSCQ77jdOtyazgnAAAAAAEJAAAcJDq8WkSCQ77jdOtyazgnAAEJ1zf4AAA=" ChangeKey="CQAAABYAAAAcJDq8WkSCQ77jdOtyazgnAAEJ6gb1" />
<t:ParentFolderId Id="AQMkADE3MTJkZWNlLTZiYWYtNDY4Yi1hNmM3LWU2MzY2AGQ2Y2FjYTEALgAAA6he2LkUW7xMk0stLmT28LwBABwkOrxaRIJDvuN063JrOCcAAAIBCQAAAA==" ChangeKey="AQAAAA==" />
<t:ItemClass>IPM.Note</t:ItemClass>
<t:Subject />
<t:Sensitivity>Normal</t:Sensitivity>
<t:Body BodyType="Text">-----BEGIN No.1 BC Mail MESSAGE-----
Version: No.1 BC Mail
wcBMA9EUSdwBcz5fAQf9FunNo+meJ5vHeHWVGzF8uyhFiRrEoLpFTQapkB6Lv0F3lqRc7lw9msQ/
dFgtlfPb0yZogodnhoxPvYDsNyZYGsvmsrqhJg3jqIVt1Kz4rlP6dhsjgOqPWbmLjRhLry37zVrC
J5dJo8bVn6XbGoorJEhDcS1iBOICsTrQk58GbOD6PIbSgCbdBqpxoJD/9kxyKVWN6iIZ5f37fsJX
mDtUTLGjKwggW5b4GWdCyhZdIPJfIVRvhkGfOBeDH0miXLeNJtkbRDYpXYt9JJgPc2pOlzYl7gfj
5PDaMmry/TIZczYuxzs+k8Mfi4NlrU3OWyujtNlDMAFvtDQQW5Fxbc/IwdJMAeh3LQc0LEXZ1JHt
3OQf8yUOvpOGLpmS3y9yKIx9Lsfs6y3iHuigid8PoBcHtqes9UKJhMa/XN0sWme4sKT0EThr8dmZ
1RzRtOgUaQ==
=NVmA
-----END No.1 BC Mail MESSAGE-----</t:Body>
<t:DateTimeReceived>2019-06-04T11:03:16Z</t:DateTimeReceived>
<t:Size>4091</t:Size>
<t:Importance>Normal</t:Importance>
<t:IsSubmitted>false</t:IsSubmitted>
<t:IsDraft>false</t:IsDraft>
<t:IsFromMe>false</t:IsFromMe>
<t:IsResend>false</t:IsResend>
<t:IsUnmodified>false</t:IsUnmodified>
<t:DateTimeSent>2019-06-04T11:03:16Z</t:DateTimeSent>
<t:DateTimeCreated>2019-06-04T11:03:16Z</t:DateTimeCreated>
<t:ResponseObjects>
<t:ReplyToItem />
<t:ReplyAllToItem />
<t:ForwardItem />
</t:ResponseObjects>
<t:DisplayCc />
<t:DisplayTo>ach</t:DisplayTo>
<t:HasAttachments>false</t:HasAttachments>
<t:ExtendedProperty>
<t:ExtendedFieldURI PropertyTag="0xe17" PropertyType="Integer" />
<t:Value>0</t:Value>
</t:ExtendedProperty>
<t:Culture>en-US</t:Culture>
<t:EffectiveRights>
<t:CreateAssociated>false</t:CreateAssociated>
<t:CreateContents>false</t:CreateContents>
<t:CreateHierarchy>false</t:CreateHierarchy>
<t:Delete>true</t:Delete>
<t:Modify>true</t:Modify>
<t:Read>true</t:Read>
<t:ViewPrivateItems>true</t:ViewPrivateItems>
</t:EffectiveRights>
<t:LastModifiedName>910024</t:LastModifiedName>
<t:LastModifiedTime>2019-06-04T11:03:16Z</t:LastModifiedTime>
<t:IsAssociated>false</t:IsAssociated>
<t:WebClientReadFormQueryString>?ItemID=AAMkADE3MTJkZWNlLTZiYWYtNDY4Yi1hNmM3LWU2MzY2ZDZjYWNhMQBGAAAAAACoXti5FFu8TJNLLS5k9vC8BwAcJDq8WkSCQ77jdOtyazgnAAAAAAEJAAAcJDq8WkSCQ77jdOtyazgnAAEJ1zf4AAA%3D&exvsurl=1&viewmodel=ReadMessageItem</t:WebClientReadFormQueryString>
<t:ConversationId Id="AAQkADE3MTJkZWNlLTZiYWYtNDY4Yi1hNmM3LWU2MzY2ZDZjYWNhMQAQAI8ZORHy7UhFk19174mVY+c=" />
<t:Sender>
<t:Mailbox>
<t:Name>910024</t:Name>
<t:EmailAddress>910024@iibo.biz</t:EmailAddress>
<t:RoutingType>SMTP</t:RoutingType>
<t:MailboxType>Mailbox</t:MailboxType>
</t:Mailbox>
</t:Sender>
<t:ToRecipients>
<t:Mailbox>
<t:Name>ach</t:Name>
<t:EmailAddress>ach@iibo.biz</t:EmailAddress>
<t:RoutingType>SMTP</t:RoutingType>
<t:MailboxType>Mailbox</t:MailboxType>
</t:Mailbox>
</t:ToRecipients>
<t:IsReadReceiptRequested>false</t:IsReadReceiptRequested>
<t:IsDeliveryReceiptRequested>false</t:IsDeliveryReceiptRequested>
<t:ConversationIndex>AQHVGsUcjxk5EfLtSEWTX3XviZVj5w==</t:ConversationIndex>
<t:ConversationTopic />
<t:From>
<t:Mailbox>
<t:Name>910024</t:Name>
<t:EmailAddress>910024@iibo.biz</t:EmailAddress>
<t:RoutingType>SMTP</t:RoutingType>
<t:MailboxType>Mailbox</t:MailboxType>
</t:Mailbox>
</t:From>
<t:InternetMessageId><8056e3f072cf4cf1a27ece3135417bba@exch2013.no1bc.local></t:InternetMessageId>
<t:IsRead>true</t:IsRead>
<t:ReceivedBy>
<t:Mailbox>
<t:Name>910024</t:Name>
<t:EmailAddress>910024@iibo.biz</t:EmailAddress>
<t:RoutingType>SMTP</t:RoutingType>
<t:MailboxType>Mailbox</t:MailboxType>
</t:Mailbox>
</t:ReceivedBy>
<t:ReceivedRepresenting>
<t:Mailbox>
<t:Name>910024</t:Name>
<t:EmailAddress>910024@iibo.biz</t:EmailAddress>
<t:RoutingType>SMTP</t:RoutingType>
<t:MailboxType>Mailbox</t:MailboxType>
</t:Mailbox>
</t:ReceivedRepresenting>
</t:Message>
</m:Items>
</m:GetItemResponseMessage>
</m:ResponseMessages>
</m:GetItemResponse>
</s:Body>
</s:Envelope>
您可以看到我添加的属性丢失了。为什么这样?我在做什么错了?
答案 0 :(得分:1)
EWS不会使您失望-它也不返回任何其他属性:使用MFCMAPI或OutlookSpy(单击IMessage按钮)查看该消息上可用的所有其他属性。
作为一般规则,如果要特定的属性,则需要在GetItem
请求(ItemShape\AdditionalProperties\ExtendedFieldURI
)中明确指定它