英文:
Exchange web services - find all unread messages with soap xml request
问题
在我的应用程序中,我需要查询Exchange Web Services服务器并找到所有未读消息。我正在使用Golang发送SOAP XML请求。我尝试了以下代码:
<?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="Exchange2013_SP1" />
</soap:Header>
<soap:Body>
<m:FindItem
Traversal="Shallow">
<m:ItemShape>
<t:BaseShape>IdOnly</t:BaseShape>
</m:ItemShape>
<m:Restriction>
<t:IsEqualTo>
<t:FieldURI FieldURI="item:IsRead" />
<t:FieldURIOrConstant>
<t:Constant Value="false" />
</t:FieldURIOrConstant>
</t:IsEqualTo>
</m:Restriction>
<m:ParentFolderIds>
<t:DistinguishedFolderId Id="inbox" />
</m:ParentFolderIds>
</m:FindItem>
</soap:Body>
</soap:Envelope>
但是在这种情况下,我收到错误消息说我的请求不正确。如果我删除<t:IsEqualTo>
,我会得到收件箱中的所有消息。有什么办法可以修复这个问题吗?谢谢。
英文:
in my app I need to query Echange web services server and find all unread messages. I am using Golang and I am sending soap xml requests. I tried the following:
<?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="Exchange2013_SP1" />
</soap:Header>
<soap:Body>
<m:FindItem
Traversal="Shallow">
<m:ItemShape>
<t:BaseShape>IdOnly</t:BaseShape>
</m:ItemShape>
<m:Restriction>
<t:IsEqualTo>
<t:FieldURI FieldURI="item:IsRead" />
<t:FieldURIOrConstant>
<t:Constant Value="false" />
</t:FieldURIOrConstant>
</t:IsEqualTo>
</m:Restriction>
<m:ParentFolderIds>
<t:DistinguishedFolderId Id="inbox" />
</m:ParentFolderIds>
</m:FindItem>
</soap:Body>
</soap:Envelope>
but in this case I get error saying that my request is incorrect. If I remove <t:IsEqualTo>
, I get all messages in my inbox. Any ideas how to fix it would be welcome. Thank you
答案1
得分: 2
根据FieldURI属性列表,item:IsRead
应该是message:IsRead
。以下是从在EWS中使用搜索过滤器中复制的示例:
<t:IsEqualTo>
<t:FieldURI FieldURI="message:IsRead" />
<t:FieldURIOrConstant>
<t:Constant Value="false" />
</t:FieldURIOrConstant>
</t:IsEqualTo>
英文:
According to the list of FieldURI Attribute, item:IsRead
should be message:IsRead
. Below is the example copied from Equality filter in EWS
:
<t:IsEqualTo>
<t:FieldURI FieldURI="message:IsRead" />
<t:FieldURIOrConstant>
<t:Constant Value="false" />
</t:FieldURIOrConstant>
</t:IsEqualTo>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论