none
C#: Interop.Outlook.AppointmentItem.IsRecurring inconsistent timing access on shared calendars. RRS feed

  • Question

  • As part of its functionalities, our add-in needs to know if the selection has changed in the Outlook explorer. So it implements a polling process of 300ms frequency in order to check the current selection. This implies the access to the selection's Outlook COM properties (note: our add-in is implemented in C#).

    In particular, on calendar items (Appointment) we need to access the IsRecurring property (through the _AppointmentItem Outlook Object Model - https://msdn.microsoft.com/en-us/library/bb609491(v=office.12).aspx) and we found out the following: it did not take time to fetch this property when the mailbox cache is fully set (Use Cached Exchange mode and Download shared folders) - Full Cache mode - or not set at all - Full Online mode - whereas it is time-consuming in Hybrid mode (Use Cached Exchange mode but shared folder are not downloaded).

    Because of that, Outlook hangs in Hybrid mode when the user selects recurring items in a shared calendar and that the access time to the IsRecurring property is longer than the polling frequency.

    We tested out with 32-bit Outlook versions 14.0.5128.5000 and 16.0.4549.1000 installed on a PC located in France while the Exchange server is hosted in the US and here are the timing results we got:

    Out of 3 shared calendars, 3 times 10 trials on each recurring appointment.

     

    Mail configuration

    Durations of IsRecurring fetching

    Full Cache


     

    0ms

     

    Hybrid

     

    Average of 500 to 1500ms

    Full Online

     

    0ms

    Table: Fetch duration of IsRecurring property in Outlook from a currently selected recurring appointment in a shared calendar.

     

    As we can see in above Table, fetching IsRecurring property in Hybrid mode takes time while it does not in both other modes. We would have expected Hybrid mode to behave the same as the two others.

    What could explain that fetching the property is not instantaneous in Hybrid mode?

    Is there another way to retrieve the IsRecurring property that would cost no time in any mode?

    Being able to know whether the selection has changed is crucial for our add-in's features.

    • Reproduction steps to get access time on IsRecurring property of a calendar item:
    1. Set up the Full Online cache mode of your exchange mail account,
    2. Restart Outlook,
    3. Go to Calendar view,
    4. Add or select a shared calendar on which you have full access rights,
    5. Create a recurring meeting,
    6. Select the recurring meeting (do not open it)
    7. Ensure the calendar is the only opened one (do not superimpose two calendars, otherwise fetching IsRecurring throws instantaneously),
    8. Run VBA code - given below - and read access time in the immediate window (expected 0ms)
    9. Set up the hybrid cache mode of your exchange mail account,
    10. Restart Outlook,
    11. Go back to your shared calendar
    12. Select the same item (do not open it)
    13. Ensure the calendar is the only opened one
    14. Run VBA code and read access time in the immediate window (you should see that it takes time)
    • VBA code to time IsRecurring fetching
    Declare Function GetTickCount Lib "kernel32" () As Long
    
    Sub Main()
    Dim tick As Long
    Dim prop As Boolean
    Dim oomAppt As AppointmentItem
    
    Set oomAppt = ActiveExplorer.Selection.Item(1)
    tick = GetTickCount
    prop = oomAppt.IsRecurring
    
    Debug.Print GetTickCount - tick & "ms"
    End Sub
    • Edited by jwissocq Monday, August 7, 2017 8:50 AM Formatting issues.
    Friday, August 4, 2017 5:03 PM

All replies

  • Why would you want to use polling instead of the Explorer.SelectionChange event?

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

    Friday, August 4, 2017 5:16 PM
  • Hello,

    I followed your steps but failed to reproduce the issue.

    Here is my test result: Online mode>Hybrid >Full Cached and I think it is expected.

    16.0.4549.1000
    Recurring Normal
    Online 2700ms  700ms
    Hybrid 1700ms  400ms
    Cached 0ms 0ms

    1701 7766.2099
    Recurring Normal
    Online 3500ms 700ms
    hybrid 3000ms 600ms
    Cached 0ms 0ms

    If you get 0ms when using online mode, I suggest you check if there any sync issues like

    15:59:29 Synchronizer Version 16.0.8201

    15:59:29 Synchronizing Mailbox ''

    15:59:29 Synchronizing server changes in folder ' - Calendar'

    15:59:29 Downloading from server 'https://outlook.office365.com/mapi/emsmdb/?MailboxId=a5c2f999-6c'

    15:59:30 Error synchronizing folder

    15:59:30                                 [80070005-508-80070005-560]

    15:59:30                                 You do not have sufficient permission to perform this operation on this object.  See the folder contact or your system administrator.

    15:59:30                                 Microsoft Exchange Information Store

    15:59:30                                 For more information on this failure, click the URL below:

    15:59:30                                 https://www.microsoft.com/support/prodredirect/outlook2000_us.asp?err=80070005-508-80070005-560

    15:59:30 Done

    If I receive the sync error, all are the 0ms.

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Monday, August 7, 2017 7:38 AM
    Moderator
  • @Dmitry, I guess my predecessor chose deliberately not to use it in order to suit our add-in needs. But I can test the implication of using this event.

    @Celeste, I do not get any synchronization log error when I get instantaneaously IsRecurring in Online mode, (plus I would not get "True" if it were a dummy value.)

    I can reproduce instant access to IsRecurring on recurring appointment in my main personal calendar in Full Online mode. For comparison, IsOnlineMeeting property costs time. Could you please test on your main personal calendar "Calendar" as well?

    Besides, we can unveil minimal cache for items in shared calendars: even if we cannot turn Working Offline mode in Full Online mode, we can workaround by superimposing calendars.

    1. Set up the Full Online mode,
    2. Restart Outlook,
    3. Open any calendar,
    4. Do superimpose with a shared calendar on which you have full access rights,
    5. Select a recurring appointment,
    6. Open Visual Basic for Application,
    7. Display Watch window from View tab,
    8. Add Watch with expression "ActiveExplorer.Selection.Item(1)" in "(All Procedures)" context procedure,
    9. Open Expression:

    10. Set up the Hybrid mode,
    11. Restart Outlook,
    12. Calendar superimposition should remain,
    13. Select the same item,
    14. Watch the same expresion in VBA:

    Thanks,

    Julien.


    • Edited by jwissocq Friday, August 11, 2017 9:27 AM
    Thursday, August 10, 2017 5:14 PM
  • Hello Julien,

    For my personal calendar in full online mode, the recurring appointment items cost different time for different version.

    In Office 1701 (latest for deferred channel), it is 0ms or 15-16ms, IsOnlineMeeting costs 3000ms

    In Office 1707 (latest for current channel), it is 3000ms-4000ms, IsOnlineMeeting costs 3000ms

    My test environment which installing msi package is broken, sorry that i could not offer the result.

    Regards

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, August 14, 2017 9:31 AM
    Moderator
  • Hi @Dmitry, I found back the very first implementation and it indeed used Explorer.SelectionChange event, but because our add-in uses a word editor highlight overlay on mail content, the polling process had to be implemented.

    I would be interested if you reproduce my issue.

    Thank you.

    Thursday, August 24, 2017 12:11 PM
  • Why would SelectionChange event prevent you from using "word editor highlight overlay"? If you do not want to do anything in the SelectionChange event use a timer: enable the timer in the SelectionChange event, when the timer event fires (you will be out of the SelectionChange event handler), disable the timer (so it won't fire again) and run your "word editor highlight overlay" code.

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

    Thursday, August 24, 2017 1:43 PM