How to read a shared calendar information from Exchange server programatically RRS feed

  • Question

  • Hi

    We need to read few shared Group calendars meeting information from exchange server. I could see few articles which illustrate how outlook calendars meeting information can be read from the PST file. But we do not want to get the details from PST but want to read the meeting details ( shared calendar) from exchange server programatically.

    For ex: If there are 5 group calendars that are shared with me. I would like to programatically fetch the calendar information from all the 5 group calendars to which I have access and then push the data to custom DB tables for reporting.

    Pls suggest. FYI we use Outlook 2016.



    Monday, September 17, 2018 2:13 PM

All replies

  • I would suggest you start with this


    Wednesday, September 19, 2018 6:31 AM
  • Thanks Glen.

     I have used the code snippet and modified to fetch appointments from a shared calendar (I am one of the owners on the Shared calendar), but when I am binding the FolderID it throws error "The specified folder could not be found in the store"

    What does this mean? Is it expecting a Group Mail Box? I have full permissions on the Shared Calendar and not sure why it says Folder could not be found.

    If I replace the Mailbox name with mine

    CalendarFolder SharedCalendarFolder = CalendarFolder.Bind(service, new FolderId(WellKnownFolderName.Calendar, "") , new PropertySet());

    , then it goes through and reads my personal calendar but does not read when I access the Shared Calendar. Please suggest if I am missing?

    NameResolutionCollection ncCol = service.ResolveName(lnLegDN, ResolveNameSearchLocation.DirectoryOnly, false); FolderId SharedCalendarFolderId = new FolderId(WellKnownFolderName.Calendar, ncCol[0].Mailbox.Address); CalendarFolder SharedCalendaFolder = CalendarFolder.Bind(service, SharedCalendarFolderId , new PropertySet());

    // ncCol[0].Mailbox.Address shows the Shared Calendar name. Microsoft.Exchange.WebServices.Data.CalendarView cView = new Microsoft.Exchange.WebServices.Data.CalendarView(startDate, endDate, NUM_APPTS); cView.PropertySet = new PropertySet(AppointmentSchema.Subject, AppointmentSchema.Start, AppointmentSchema.End); FindItemsResults<Appointment> appointments = SharedCalendarFolder.FindAppointments(cView);

     foreach (Appointment a in appointments)
                                        Console.Write("Subject: " + a.Subject.ToString() + " ");
                                        Console.Write("Start: " + a.Start.ToString() + " ");
                                        Console.Write("End: " + a.End.ToString());

    Wednesday, September 19, 2018 5:56 PM
  • That error is usually related to not having rights to the folder your trying to access. A few questions can you access that folder in OWA logged on as the user you using ? . Is this Office365 in hybrid where these mailboxes are located OnPrem and the Mailbox your using is in the cloud (or vice versa).

    Any reason you using resolvename ? one other test i would suggest performing is use EWSEditor and then try to access the folder (Once you have logged on right click the folder tree and select Add Root folder)


    Wednesday, September 19, 2018 11:21 PM
  • Hi Glen,

    I am trying to access the shared calendars and I have full permissions on them. Please see the screenshots below:

    We usually do not access the mails from OWA (sorry never tried actually). 

    I am a newbie when it comes to EWS and it would be great if you can share some code snippet to accomplish the requirement. I am able to read the Shared Calendar names but not sure how to get into them and read the appointments. I tried from using the code mentioned in the post, but that gives error. Can you please suggest the right and simplest way. I was also trying to access the Shared Calendar appointments from MAPI but there also I am stuck, please see the post here: (

    Please suggest.

    Thursday, September 20, 2018 12:55 AM