用python检查outlook中会议室的可用性

时间:2018-05-17 08:44:04

标签: python-3.x outlook

我正在编写一个python脚本来检查特定的会议室是否可用。如果是,则会预订会议室,否则python会找到当天的可用时段。

目前,我已经完成预订会议室但我无法检查房间的可用性。

要预订任何会议室,我必须发送邮件到该书会议室配置的邮件ID和我收到的相应接受/拒绝邮件。

下面的

是片段:

import win32com.client
import datetime
import pywintypes

oOutlook = win32com.client.Dispatch("Outlook.Application")
appt = oOutlook.CreateItem(1)
appt.Start = '2018-05-18 13:30'
appt.Subject = 'Follow Up Meeting'
appt.Duration = 30
appt.Location = '<name of meeting room>'
appt.MeetingStatus = 1
myRecipient = appt.Recipients.Add("<mail id of meeting room")
myRecipient.resolve
my_date = datetime.date(2018,5,18)
pywintypeDate = pywintypes.Time (my_date)
availabilityInfo = myRecipient.FreeBusy(pywintypeDate,30,True)
print(availabilityInfo)
#   appt.Save()
#   appt.Send()
#   print("done")

输出是:

000000000000000000000222222200222222022000000000000000000000000000000002222222222220000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000002220002222200000000000000000000000000000000002220022022222000000000000000000000000000000000000000000002222000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000222222200000000000000000000000000000000002220000022000000000000000000000000000000000000002220000222222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000002220022022200000000000000000000000000000000000022000022000000000000000000000000000000000000000000000002222000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000022022200000000000000000000000000000000002220002222000000000000000

所以第一个字节(0)表示从00:00到00:30的时段以及很快一个月的时间段吗?

是否有可能只获得一天的输出?

我是否必须解析上述输出以检查特定所需时间的可用性?

1 个答案:

答案 0 :(得分:1)

appt.Recipients.Add返回Recipient个对象。首先解析它(Recipient.Resolve),然后调用Recipient.FreeBusy