I am trying to read the AppointmentItem.BusyStatus from a shared calendar with limited access. I can see the BusyStatus for the entire day/week, but do not have access to information like the subject or location of an appointment.
My code looks like the following:
At first, I get the folder in which the shared calendars are stored.
oApp = new Outlook.Application();
mapiNamespace = oApp.GetNamespace("MAPI");
Outlook.Recipient oRep = mapiNamespace.CreateRecipient(oApp.Session.CurrentUser.Name);
calendarsFolder = mapiNamespace.GetSharedDefaultFolder(oRep, Outlook.OlDefaultFolders.olFolderCalendar).Folders;
In the next step, I iterate over all the calendars and their appointment items.
foreach(Outlook.Folder calendar in calendarsFolder){
Console.WriteLine(calendar.Name);
foreach(Outlook.AppointmentItem item in calendar.Items){
Console.WriteLine(item.Start.ToString("dd.MM.yyyy"));
Console.WriteLine(item.BusyStatus);
}
}
This code works just fine on a calendar which grants me full control to read any details the appointment may have. It does not work on the calendar with limited access though. After debugging my code, I found out that the calendar.Items list of this particular calendar is empty, its count is 0. I am assuming this has to do with me not having the proper authorization to retrieve this information, since I could read the subject and location if I got the appointment items. This is just an assumption however, and I am honestly not quite sure what is going on. Do I need an entirely different approach or am I just missing something? I would really appreciated it, if someone could help me out.