我想将开始日期和结束日期的时区更改为 CST(美国/中部时间),我在此处编码的时间会自动转换为本地时间,因此在将其放入本地时间后会更改appointment.Start = "yyyy-MM-dd hh:mm:ss"
。我还想知道如何将这次约会的发件人更改为我将提供的 gmail。因为appointment.Organizer = "gmail"
不工作也不appointment.SendUsingAccount = "gmail"
行
这是代码:
acc = ""
for account in session.Accounts:
if account.AccountType == 1: #0 - outlookExchange, 1 - outlookIMAP, 2 - outlookPop3
print(account)
acc = account
def saveMeeting(start, end, subject, location, attachments, recipients):
appointment = outlook.CreateItem(1) #1 - AppointmentItem
# Fill in the data needed
appointment.SendUsingAccount = acc
appointment.StartTimeZone = outlook.TimeZones("Central Standard Time")
appointment.Start = start #yyyy-MM-dd hh:mm:ss
appointment.EndTimeZone = outlook.TimeZones("Central Standard Time")
appointment.End = end #yyyy-MM-dd hh:mm:ss
appointment.Subject = subject
appointment.Location = location
appointment.MeetingStatus = 1
if attachments != '':
appointment.Attachments.Add(attachments)
recipients = filter(None, recipients)
for recipient in recipients:
appointment.Recipients.Add(recipient)
appointment.Save()
# Only use .Display() if using tkinter
appointment.Display()