none
How to check if Me.OutlookItem is recurring exceptional appointment? RRS feed

  • Question

  • In my AddIn, I would like to get the OriginalDate of the event if it's exceptional event. How can I do it?

    Remark:

    My objective is to get an unique identifier of an an item. Since all exceptional events share the same entryid of it's parent event. I need an additional field to uniquely identify them. I think  OriginalDate  is the best field for this case. If there is other alternatives, please advise.

    Here is the sample:

     Dim currentItem As Object = Me.OutlookItem
     With currentItem
       
      If (TypeOf currentItem Is Outlook.AppointmentItem) Then
                   
                    If (currentItem .IsRecurring) Then
                          
    ' How do I know this is a parent recurring event or the exceptional event?
                            ' If it's exceptional event, I would like to get the OriginalDate of this event.
                    End If
                 

       End If

     end with

     Marshal.ReleaseComObject(currentItem)

    Thanks,

    Cowcow

    Wednesday, August 13, 2014 12:52 AM

Answers

  • Use the AppointmentItem.RecurrenceState property:

    olApptException

    3  

    The appointment is an exception to a recurrence pattern defined by a master appointment. 

    olApptMaster

    1  

    The appointment is a master appointment.

    olApptNotRecurring

    0  

    The appointment is not a recurring appointment.

    olApptOccurrence

    2  

    The appointment is an occurrence of a recurring appointment defined by a master appointment.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!


    Wednesday, August 13, 2014 5:58 AM
  • Hello Cowcow,

    The AppointmentItem class doesn't provide such property.

    But the Exception class provides the OriginalDate property. You need to find a corresponding instance of the Exception class, see the Exceptions property of the ReccurencePattern class. Note, you can get an instance of the ReccurencePattern class any time using the GetRecurrencePattern method of the AppointmentItem class. For example:

     'Get the recurrence pattern for the master  
     'AppointmentItem. Access the collection of  
     'exceptions to the regular appointments.  
     Set myRecurrPatt = myApptItem.GetRecurrencePattern  
     Set myException = myRecurrPatt.Exceptions.item(1) 
    
     'Display the original date, time, and subject  
     'for this exception.  
     MsgBox myException.OriginalDate & ": " & saveSubject 
     
     'Display the current date, time, and subject  
     'for this exception.  
     MsgBox myException.AppointmentItem.Start & ": " & _  
     myException.AppointmentItem.Subject 


    • Edited by Eugene Astafiev Thursday, August 14, 2014 10:59 AM
    • Marked as answer by cowcow222 Friday, August 15, 2014 6:35 AM
    Thursday, August 14, 2014 10:57 AM

All replies

  • Use the AppointmentItem.RecurrenceState property:

    olApptException

    3  

    The appointment is an exception to a recurrence pattern defined by a master appointment. 

    olApptMaster

    1  

    The appointment is a master appointment.

    olApptNotRecurring

    0  

    The appointment is not a recurring appointment.

    olApptOccurrence

    2  

    The appointment is an occurrence of a recurring appointment defined by a master appointment.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!


    Wednesday, August 13, 2014 5:58 AM
  • Thank you, that works.

    Is it possible to also get the OriginalDate if it's exceptional event?

    Regards,

    Cowcow.

     
    Thursday, August 14, 2014 9:53 AM
  • Hello Cowcow,

    The AppointmentItem class doesn't provide such property.

    But the Exception class provides the OriginalDate property. You need to find a corresponding instance of the Exception class, see the Exceptions property of the ReccurencePattern class. Note, you can get an instance of the ReccurencePattern class any time using the GetRecurrencePattern method of the AppointmentItem class. For example:

     'Get the recurrence pattern for the master  
     'AppointmentItem. Access the collection of  
     'exceptions to the regular appointments.  
     Set myRecurrPatt = myApptItem.GetRecurrencePattern  
     Set myException = myRecurrPatt.Exceptions.item(1) 
    
     'Display the original date, time, and subject  
     'for this exception.  
     MsgBox myException.OriginalDate & ": " & saveSubject 
     
     'Display the current date, time, and subject  
     'for this exception.  
     MsgBox myException.AppointmentItem.Start & ": " & _  
     myException.AppointmentItem.Subject 


    • Edited by Eugene Astafiev Thursday, August 14, 2014 10:59 AM
    • Marked as answer by cowcow222 Friday, August 15, 2014 6:35 AM
    Thursday, August 14, 2014 10:57 AM
  • Thank you. 
    Friday, August 15, 2014 6:36 AM