Outlook 2013 - C# Add-in - Accessing Occurrences from a Recurring Meeting - Crashes Outlook RRS feed

  • Question

  • Hi,

    I am trying to access the Occurrences from a recurring meeting using OOM. While accessing the occurrence through the code, Outlook crashes abruptly. 

    This issue happens only in Exchange Active Sync account ( calendar items and the calendar was created online (from the web). For Exchange accounts, IMAP accounts the code works fine without any issues.

    The appointment item is a Recurring, NoEndDate, AllDayEvent item created from the (website) calendar.

                Outlook.Explorer activeExplorer = this.Application.ActiveExplorer();  	  

    if (activeExplorer != null) { Outlook.AppointmentItem selectedItem = activeExplorer.Selection[1] as Outlook.AppointmentItem; if (selectedItem != null) { Outlook.RecurrencePattern rp = selectedItem.GetRecurrencePattern(); if (rp.Occurrences > 0) { DateTime dt = new DateTime(2015,06,16,0,0,0); Outlook.AppointmentItem recur = rp.GetOccurrence(dt); if (recur != null) { richTextBox1.Text = recur.Start + "\n" + recur.End + "\n" + rp.Duration; ((Outlook._AppointmentItem)recur).Close(Outlook.OlInspectorClose.olDiscard); Marshal.FinalReleaseComObject(recur); recur = null; } Marshal.FinalReleaseComObject(rp); rp = null; } ((Outlook._AppointmentItem)selectedItem).Close(Outlook.OlInspectorClose.olDiscard); Marshal.FinalReleaseComObject(selectedItem); selectedItem = null; } }

    When i debug the code, crash happens exactly at the following line

     Outlook.AppointmentItem recur = rp.GetOccurrence(dt);

    What is the reason? how to over come this issue?


    Windows 8.1 64bit

    Outlook 2013 64bit

    .NET Framework 4.0

    Visual Studio 2013

    C#, OOM (Exchange Active Sync) account configured in my outlook and calendars were created online (from the web)

    Error information from the Event Log (EventViewer)

    Fault bucket 85990716651, type 4
    Event Name: APPCRASH
    Response: Not available
    Cab Id: 0

    Problem signature:
    P1: Outlook.exe
    P2: 15.0.4569.1503
    P3: 52b0c226
    P4: KERNELBASE.dll
    P5: 6.3.9600.17415
    P6: 54505737
    P7: e0434352
    P8: 0000000000008b9c

    Attached files:

    These files may be available here:

    Analysis symbol: 
    Rechecking for solution: 0
    Report Id: 87c7715e-1105-11e5-bebb-448a5b750f5b
    Report Status: 0
    Hashed bucket: 5d7316685f83fb9dd24fe8282071ce04


    Faulting application name: Outlook.exe, version: 15.0.4569.1503, time stamp: 0x52b0c226
    Faulting module name: KERNELBASE.dll, version: 6.3.9600.17415, time stamp: 0x54505737
    Exception code: 0xe0434352
    Fault offset: 0x0000000000008b9c
    Faulting process id: 0x20e4
    Faulting application start time: 0x01d0a5123ab0b89a
    Faulting application path: C:\Program Files\Microsoft Office\Office15\Outlook.exe
    Faulting module path: C:\WINDOWS\system32\KERNELBASE.dll
    Report Id: 87c7715e-1105-11e5-bebb-448a5b750f5b
    Faulting package full name: 
    Faulting package-relative application ID: 

    • Edited by Raghunathan S Friday, June 12, 2015 1:38 PM Added crash info from the EventLog
    Friday, June 12, 2015 1:36 PM

All replies

  • Hello Raghunathan,

    Why do you need to use the FinalReleaseComObject method in the code?

    I'd suggest starting from replacing the FinalReleaseComObject methods with the ReleaseComObject ones. It may cause the issue...

    Use System.Runtime.InteropServices.Marshal.ReleaseComObject to release an Outlook object when you have finished using it. Then set a variable to Nothing in Visual Basic (null in C#) to release the reference to the object. Read more about that in the Systematically Releasing Objects article in MSDN.

    Friday, June 12, 2015 1:49 PM
  • Does it happen only for that particular appointment for the occurrence on that particular date?

    Dmitry Streblechenko (MVP)
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Friday, June 12, 2015 4:53 PM
  • Hi,

    Crash happens for whenever i try to read the recurrences from any recurring meeting in that calendar (Exchange Active Sync- mail account)

    I tried using redemption, and  i am able to get the occurrence, but unable to read the values from the following four properties of an occurrence

    Duration, Start, End, AllDayEvent. 

    If i try to access any one of the property, outlook crashes.

    Monday, June 15, 2015 6:15 AM
  • Did you try to remove the Marshal.FinalReleaseComObject statements?
    Monday, June 15, 2015 8:39 AM
  • What exactly do you mean by "unable to read the values from the following four properties of an occurrence Duration, Start, End, AllDayEvent. "

    Do you get an error? Or an unexpected result?

    Dmitry Streblechenko (MVP)
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Monday, June 15, 2015 2:11 PM
  • Hi Eugene

    I tried change FinalReleaseComObject to ReleaseComObject, still no luck

    it crashes outlook, for the calendar from the particular ( - Exchange Active Sync) account. Other accounts are working.

    Tuesday, June 16, 2015 7:31 AM
  • Hi Dmitry

    I meant, that i am able to get the Occurrence Appointment Object using Redemption  and able to access the properties like Subject, Participants, Location etc

    but when i try to access the values for the AllDayEvent, Duration, Start and End properties, outlook crashes without any exception or info

    Tuesday, June 16, 2015 7:33 AM
  • What is the relevant snippet of your code that causes the problem? Send me an email to redemption at dimastr dot com and I will send you the debug version of Redemption.

    Dmitry Streblechenko (MVP)
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Tuesday, June 16, 2015 3:16 PM