title: Read Outlook Events via Python
body: <p>Outlook has some things to desire - like showing multiple month view</p>
  <p>I decided to give it a try by pulling out the event data via Python (and then figure a way to display it nicely). Google is giving poor results.</p>
  <p>My goals are:</p>
  <ul>
  <li>read a shared calendar</li>
  <li>read the events information like start, end, subject, creator, etc.</li>
  </ul>
  <p>This is what I got together (with inspiration from <a href="http://cephas.net/blog/2004/09/17/sending-your-outlook-calendar-using-python/" rel="nofollow noreferrer">this site</a>)</p>
  <pre><code>import win32com.client, datetime
  from dateutil.relativedelta import relativedelta
  
  Outlook = win32com.client.Dispatch(&quot;Outlook.Application&quot;)
  ns = Outlook.GetNamespace(&quot;MAPI&quot;)
  
  appointments = namespace.GetDefaultFolder(9).Items 
  # TODO: Need to figure out howto get the shared calendar instead Default [9] 
  # (I have placed the shared folder into a separate folder - don't know if it matters)
  # I would just like the user to select which calendar to execute on
  appointments.Sort(&quot;[Start]&quot;)
  appointments.IncludeRecurrences = &quot;True&quot;
  begin = date.today().strftime(&quot;%m%d%Y&quot;)
  end = (date.today() + relativedelta( months = 3 )).strftime(&quot;%m%d%Y&quot;)
  appointments = appointments.Restrict(&quot;[Start] &gt;= '&quot; +begin+ &quot;' AND [END] &gt;= '&quot; +end+ &quot;'&quot;)
  </code></pre>
  <p>How do I loop through the events and read them?</p>