title: Error Reading Outlook Calendar Appointment with C# program
body: <p>I am getting an error with a C# windows app trying to read Outlook calendar info
  This worked previously however I think a security related change happened on the server side that I can see nor will I be told about.</p>
  
  <p>I am using Outlook 2010 (v14.0.3129.5000)</p>
  
  <p>There error I get is:</p>
  
  <blockquote>
    <p>System.Runtime.InteropServices.COMException (0x80004005): Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))</p>
  </blockquote>
  
  <p>The error occurs when trying to read the appointment body:</p>
  
  <pre><code>if (oAppt.Body != null)
  </code></pre>
  
  <p>I can ready other calendar properties with no issues</p>
  
  <pre><code>Microsoft.Office.Interop.Outlook.RecurrencePattern recurrencePattern;
  Microsoft.Office.Interop.Outlook.NameSpace oNS;
  Microsoft.Office.Interop.Outlook.MAPIFolder oCalendar;
  Microsoft.Office.Interop.Outlook.Items oItems;
  Microsoft.Office.Interop.Outlook.AppointmentItem oAppt;
  
  Microsoft.Office.Interop.Outlook.Application _OutlookApplication;
  
  
  try
  {
    _OutlookApplication = new Microsoft.Office.Interop.Outlook.Application();
    oNS = _OutlookApplication.GetNamespace("MAPI");
  
    // Get the Calendar folder.
    oCalendar = oNS.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderCalendar);
  
    oCalendar.Items.IncludeRecurrences = true;
  
  
    // Get the Items (Appointments) collection from the Calendar folder.
    oItems = oCalendar.Items;
  
    for (Int32 x = 1; x &lt;= oItems.Count; x++)
    {
       //Need to change how we are getting the appointment
       //Apparently Outlook will return non-appointments in the calendar feed
       try
       {
          oAppt = (Microsoft.Office.Interop.Outlook.AppointmentItem)oItems[x];
          Console.WriteLine(oAppt.Subject);
        }
        catch (Exception)
        {
           continue;
        }
  
        if (oAppt.Body != null)
           Console.WriteLine("      Calendar Body:" + oAppt.Body.ToString());
  
       }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message.ToString());
     }
   }
  </code></pre>
  
  <p>Digging through the stack trace I see the following error</p>
  
  <pre><code> at Microsoft.Office.Interop.Outlook._AppointmentItem.get_Body()
  </code></pre>
  
  <p>Can anyone help with why this error is occurring and if there is any work around I can perform?</p>