如何从 vb.net windows 表单应用程序设置 Outlook 项目的时区

How to set time zone of Outlook item from vb.net windows form app

我正在尝试将约会添加到用户的 Outlook 日历中,设置为悉尼的特定时间。但是我无法弄清楚 类 来为 AppointmentItem 设置 start/end 时区。这是我得到的:

    Dim TempApp As New Outlook.Application()
    Dim TempAppItem As Outlook.AppointmentItem = TempApp.CreateItem(Outlook.OlItemType.olAppointmentItem)

    TempAppItem.Subject = "Perform reminder action"
    TempAppItem.Body = "Reminder to perform"
    TempAppItem.Location = "No Location"
    TempAppItem.Start = Convert.ToDateTime("22/11/2021 04:00:00 PM")
    TempAppItem.End = Convert.ToDateTime("22/11/2021 05:00:00 PM")
    TempAppItem.StartTimeZone = **missing solution here**("AUS Eastern Standard Time")
    TempAppItem.EndTimeZone = **missing solution here**("AUS Eastern Standard Time")
    TempAppItem.ReminderSet = True
    TempAppItem.ReminderMinutesBeforeStart = 0
    TempAppItem.BusyStatus = Outlook.OlBusyStatus.olBusy
    TempAppItem.IsOnlineMeeting = False
    TempAppItem.Save()

    TempApp = Nothing
    TempAppItem = Nothing

当然,我在发布问题后(搜索了一个小时后)立即弄明白了。这是:

    Dim tzs As Outlook.TimeZone = TempApp.TimeZones("AUS Eastern Standard Time")
    TempAppItem.StartTimeZone = tzs
    TempAppItem.EndTimeZone = tzs