Caledar body based on room selection RRS feed

  • Question

  • I am hoping someone may be able to point me in the right direction.

    The below code will add text to the body of a appointment item, however the same text for all appointment items
    1) Can I change appointmentItem to meetingItem or do I need to. Is there a difference?
    2) Can anyone help me out so that the text that is added to the body be based on room selected?

    Public Class ThisAddIn
        Private WithEvents inspectors As Outlook.Inspectors

        Private Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup
            inspectors = Me.Application.Inspectors
        End Sub
        Private Sub inspectors_NewInspector(ByVal Inspector As Microsoft.Office.Interop.Outlook.Inspector) Handles inspectors.NewInspector
            Dim appointmentItem As Outlook.AppointmentItem = TryCast(Inspector.CurrentItem, Outlook.AppointmentItem)
            If Not (appointmentItem Is Nothing) Then
                If appointmentItem.EntryID Is Nothing Then
                   appointmentItem.Body = "Room #1A Ext 5548"
                End If
            End If
        End Sub
        Private Sub ThisAddIn_Shutdown() Handles Me.Shutdown

        End Sub

    End Class



    Sunday, November 17, 2013 5:11 PM


  • If the room is a resource you can find it in the appointment's Recipients collection, as a Bcc recipient. Otherwise it might just be a location in the Location field of the appointment. To check whether a recipient is a Bcc recipient check for Recipient.Type, it will be OlMailRecipientType.olBCC (3).

    In the NewInspector() event handler you are given a weak object reference to the Inspector and Inspector.CurrentItem. Many properties are not yet established until the Inspector fires its first Activate() event. Bear that in mind if you get errors or null values for various properties.

    Ken Slovak MVP - Outlook

    Monday, November 18, 2013 3:32 PM