Python 3.x Pywin32:method";限制;要在';我的代码不起作用
问题:restrict方法向我显示结果,但我不了解: 此方法的MSDN文档: 大家好 我正在尝试使用python中的pywin32阅读Outlook 2017中的约会(操作系统:Win7 x64,位置:德国)。 这是我使用的代码:Python 3.x Pywin32:method";限制;要在';我的代码不起作用,python-3.x,outlook,pywin32,Python 3.x,Outlook,Pywin32,问题:restrict方法向我显示结果,但我不了解: 此方法的MSDN文档: 大家好 我正在尝试使用python中的pywin32阅读Outlook 2017中的约会(操作系统:Win7 x64,位置:德国)。 这是我使用的代码: import win32com.client as win32 import datetime outlookinst=win32.Dispatch('Outlook.Application') ns=outlookinst.GetNamespace("MAPI")
import win32com.client as win32
import datetime
outlookinst=win32.Dispatch('Outlook.Application')
ns=outlookinst.GetNamespace("MAPI")
existappointments=ns.GetDefaultFolder(9).Items
begin=datetime.date.today()
print(begin)
end = begin+datetime.timedelta(days=1)
print(end)
restriction="[Start] >= '" + begin.strftime("%m/%d/%Y") + "' AND [End] <= '" +end.strftime("%m/%d/%Y") + "'"
existappointments = existappointments.Restrict(restriction)
nCnt=1
if (existappointments !=None):
for index in existappointments :
print(existappointments .Item(nCnt).Subject,existappointments .Item(nCnt).Start)
nCnt=nCnt+1
我的代码的结果是:
2019-02-08
2019-02-09
xxxxx 2019-01-15 08:30:00+00:00 (xxxx for subject)
xxxxx 2017-07-14 11:15:00+00:00
xxxxx 2019-01-22 16:15:00+00:00
也许我必须考虑UTC时间问题?但我真的不知道如何使它正确工作
谁能给我一些建议吗?非常感谢
要补充的一点是:
如果我不使用restrict方法,那么我可以看到这三个测试预约的结果:
...
test1 2019-02-08 08:30:00+00:00
test2 2019-02-08 10:00:00+00:00
test3 2019-02-08 13:00:00+00:00
...
test1 2019-02-08 08:30:00+00:00
test2 2019-02-08 10:00:00+00:00
test3 2019-02-08 13:00:00+00:00