1

我正在尝试使用 python、ewsclient 和 sud-ews 通过 EWS 搜索交换 2007 的电子邮件,根据我从网上找到的内容,我得出了以下代码:

import ewsclient
import suds.client
import logging
from suds.transport.https import WindowsHttpAuthenticated

email = 'me@mycompany.com'
domain = 'webmail.mycompany.com'
username = r'mycompany\me'
password = 'Password'

transport = WindowsHttpAuthenticated(username=username,password=password)
client = suds.client.Client("https://%s/EWS/Services.wsdl" % domain,transport=transport,plugins=[ewsclient.AddService(),MyPlugin()])

mfrst = client.factory.create('ns1:ItemResponseShapeType')
mfrst.BaseShape = "IdOnly"

cvt = client.factory.create('ns1:ConstantValueType')
cvt._Value = "XXX"
cet = client.factory.create('ns1:ContainsExpressionType')
cet.Constant = cvt
cet._ContainmentComparison = "IgnoreCase"
cet._ContainmentMode = "Substring"
mrt = client.factory.create('ns1:RestrictionType')
mrt.SearchExpression = cet

fot = client.factory.create('ns1:FieldOrderType')
fot._Order = "Descending"
stor = client.factory.create('ns1:NonEmptyArrayOfFieldOrdersType')
stor.FieldOrder.append(fot)

mtdfit = client.factory.create('ns1:DistinguishedFolderIdType')
mtdfit._Id = "inbox"

gfrt = client.service.FindItem(mfrst,mrt,stor,mtdfit)

但我得到的是以下错误: WebFault:服务器引发错误:'请求模式验证失败:缺少所需的属性'Traversal'。

在自述文件中,我可以看到 sud-ews增加了在调用期间指定方法属性的功能 -- '_'-prefixed params,但我不知道如何使用它。

4

0 回答 0