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

Time:12-01

I'm trying to add an appointment to the user's Outlook calendar, set for a specific time in Sydney. But I can't figure out the classes to set the start/end time zone for the AppointmentItem. Here's what I've got:

    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

CodePudding user response:

Of course I figure it out IMMEDIATELY after posting the question (following searching for an hour). Here it is:

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