Set Timezone of Outlook Appointment


  • In VB.NET 2010

    I try to follow the code in the following example to set the timezone of the Outlook Appointment.

    Imports Outlook = Microsoft.Office.Interop.Outlook
    Public Class MyTest

    Private Sub TimeZoneExample()
        Dim appt As Outlook.AppointmentItem = _
            CType(Application.CreateItem( _
            Outlook.OlItemType.olAppointmentItem), Outlook.AppointmentItem)
        Dim tzs As Outlook.TimeZones = Application.TimeZones
        ' Obtain timezone using indexer and locale-independent key
        Dim tzEastern As Outlook.TimeZone = tzs("Eastern Standard Time")
        Dim tzPacific As Outlook.TimeZone = tzs("Pacific Standard Time")
        appt.Subject = "SEA - JFK Flight"
        appt.Start = DateTime.Parse("8/9/2006 8:00 AM")
        appt.StartTimeZone = tzPacific
        appt.End = DateTime.Parse("8/9/2006 5:30 PM")
        appt.EndTimeZone = tzEastern
    End Sub


    I got the error in the following line

     Dim tzs As Outlook.TimeZones = Application.TimeZones   <======= 'TimeZones' is not a member of "System.Windows.Forms.Application"

    Any idea how to fix it?

    Saturday, July 21, 2012 1:47 PM


All replies