在我的应用程序中,我需要查询Echange Web服务服务器,并找到所有未读的邮件.我使用的是Golang,我发送的是SOAPXML请求.我try 了以下几种方法:

<?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>封邮件,我的收件箱中将收到所有邮件.任何如何修复它的 idea 都将是受欢迎的.谢谢

推荐答案

根据the list of FieldURI Attribute,item:IsRead应该是message:IsRead.下面是从Equality filter in EWS 复制的示例:

<t:IsEqualTo>
  <t:FieldURI FieldURI="message:IsRead" />
  <t:FieldURIOrConstant>
    <t:Constant Value="false" />
  </t:FieldURIOrConstant>
</t:IsEqualTo>

Go相关问答推荐

+在具有html/模板Golang的Base64中

golang有int32溢出吗?

在nixos上找不到XInput2.h头文件的包

JetBrains Goland,禁用突出显示测试文件

go mod tidy会自动升级go.mod中的go版本吗?

在golang二进制中嵌入SvelteKit

使用GOTK3和librsvg在Go中如何加载内联SVG?

Golang 发送Post请求出现400错误

这是泛型的有效用例吗?

Opensearch 错误 ping 弹性服务器:由未知权威签署的 x509 证书

使用 Grafana alert 在几分钟内重复alert

如何使用 Docker 引擎 SDK 和 Golang 运行 docker 挂载卷

仅在工作日运行 cron

为什么 reflect.TypeOf(new(Encoder)).Elem() != reflect.TypeOf(interfaceVariable)?

我相信我正确地在 sRGB 和线性 RGB 之间进行了转换,那么为什么深色的结果看起来更糟呢?

如果服务器在客户端的 gRPC 中不可用,则等待的方法

Golang - 无法从 pipped Windows 命令中获取结果

如何在循环中旋转图像以便在 golang 中创建 GIF?

Go generics:我会在哪里使用 any 而不是 interface{}?

关于GO的几个问题