none
MAppointment.StartTimeZone.DisplayName System.NullReferenceException was unhandled RRS feed

  • Question

  • Hi All,

    I am using EWS Managed API 1.2 against Exchange 2010 SP2. I want to get the Appointments from a Specific Date and i want to get the TimeZone Informaition from the StartTime and the EndTime. When i try to get these Properties i get a System.NullReference Exception.

    Dim startDate, endDate As New Date

    startDate = CalDatePickerStart.Value.ToString(

    "d") & " " & cboCalStartTime.SelectedValue & ":00"

    endDate = CalDatePickerEnd.Value.ToString(

    "d") & " " & cboCalEndTime.SelectedValue & ":00"

    Dim myCalendar As CalendarFolder = CalendarFolder.Bind(EWService, WellKnownFolderName.Calendar)

    Dim dtStart As Date = startDate

    Dim dtend As Date = endDate

    Dim CalView As New CalendarView(dtStart, dtend)

    Try

    CalView.PropertySet =

    New PropertySet(BasePropertySet.FirstClassProperties, ItemSchema.Subject, ItemSchema.Categories)

    Dim fResults As FindItemsResults(Of Appointment) = myCalendar.FindAppointments(CalView)

    If fResults.TotalCount > 0 Then

    txtDebug.Text = (

    "Total found: " & fResults.TotalCount)

    For Each MAppointment As Appointment In fResults.Items

    txtDebug.Text = txtDebug.Text & vbCrLf & (

    "Subject: " & MAppointment.Subject)

    'txtDebug.Text = txtDebug.Text & vbCrLf & ("Body: " & MAppointment.Body.Text)

    txtDebug.Text = txtDebug.Text & vbCrLf & (

    "Start: " & MAppointment.Start)

    txtDebug.Text = txtDebug.Text & vbCrLf & (

    "StartTimeZone: " & MAppointment.StartTimeZone.DisplayName)

    txtDebug.Text = txtDebug.Text & vbCrLf & (

    "End: " & MAppointment.End)

    txtDebug.Text = txtDebug.Text & vbCrLf & (

    "EndTimeZone: " & MAppointment.EndTimeZone.ToString)

    txtDebug.Text = txtDebug.Text & vbCrLf & (

    "TimeZone: " & MAppointment.TimeZone)

    txtDebug.Text = txtDebug.Text & vbCrLf & (

    "Recurring: " & MAppointment.IsRecurring)

    Next

    End If

    Catch ex As Exception

    MessageBox.Show(ex.Message)

    End TryAny Ideas? Regards Andres


    MCSE 2003 / MCSA 2003 Messaging / MCTS: Windows Server 2008 / MCTS: Windows Vista, SQL 2005 / MCTS: Microsoft System Center Operations Manager 2007 / MCITP: Enterprise Administrator / MCITP: Enterprise Messaging Administrator 2007 / 2010 / VCP - VMWare Certified Professional

    Tuesday, March 6, 2012 6:41 PM