title: How to find Calendar ID
body: <p>I need to find the ID of a Outlook Calendar. It is a public calendar with many contributors/users, but not listed as "shared".</p>
  
  <p><a href="https://i.stack.imgur.com/OHP8V.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OHP8V.png" alt="Outlook Calendars"></a> </p>
  
  <p>I want to automatically export selected calendars to an *.ics.
  Currently I only can export my default folder with:</p>
  
  <pre><code> Set oNamespace = Application.GetNamespace("MAPI")
   Set oFolder = oNamespace.GetDefaultFolder(olFolderCalendar) 
   Set oCalendarSharing = oFolder.GetCalendarExporter
   oCalendarSharing.SaveAsICal "C:\calendar.ics"
  </code></pre>
  
  <p>I need to add the "ThisOne" to the export.
  The properties do not have a location:</p>
  
  <p><a href="https://i.stack.imgur.com/oZKIR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oZKIR.png" alt="ThisOne-Properties"></a></p>
  
  <p>How to I find the ID, so I can use it with "GetFolderFromID()"? Or are there better ways to include the Calendar in the export or export it on its own?</p>
  
  <p>Edit:
  Now I think I got the Calendar-ID by using </p>
  
  <pre><code>Set oNamespace = Application.GetNamespace("MAPI")
  Set oFolderPicked = oNamespace.PickFolder
  Set oFolder = oNamespace.GetFolderFromID(oFolderPicked.EntryID, oFolderPicked.StoreID)
  Set oCalendarSharing = oFolder.GetCalendarExporter
  </code></pre>
  
  <p>but this throws a exception at the last line (GetCalendarExporter):</p>
  
  <p><a href="https://i.stack.imgur.com/HTwoJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HTwoJ.png" alt="Exception"></a></p>
  
  <p>If I export in the GUI (File -> Save), it works without a problem...</p>
  
  <p>(Later I dont want to use PickFolder and just hard-code the EntryID to the script)</p>