0
votes

I develop an Outlook VSTO add-in in C#. I need to read existing appointments from shared calendars to see busy time slots. I have the publishing editor permission over all shared calendars and it's working with non-private appointments seamlessly.

My only problem is that CalendarFolder.Items collection does not contain appointment items having olPrivate or olPersonal Sensitivity setting. While the built-in Outlook calendar view shows these items with the little lock icon.

I understand that private appointments expose only Start and End times and it would be absolutely enough for me.

The underlying Exchange server version is 2013. We use Outlook 2013 and 2016.

Any idea what can cause this?

Thank you.


UPDATE:

Finally I found a solution for this problem by using EWS Managed API 2.0.

using Microsoft.Exchange.WebServices.Data;
// ...... 
ExchangeService EWSService = new ExchangeService();
EWSService.Credentials = new WebCredentials("EXCHUser", "EXCHPW");
EWSService.Url = new Uri("https://...../EWS/Exchange.asmx");

Mailbox primary = new Mailbox(Tools.MainWindow.SelectedConsultant.Email);
var calendar = Microsoft.Exchange.WebServices.Data.CalendarFolder.Bind(EWSService, 
               new FolderId(WellKnownFolderName.Calendar, primary));
ItemView cView = new ItemView(100);

// Limit the properties returned to the appointment's subject, 
//                       start time, end time and sensitivity.
cView.PropertySet = new PropertySet(AppointmentSchema.Subject, 
                                    AppointmentSchema.Start, 
                                    AppointmentSchema.End, 
                                    AppointmentSchema.Sensitivity);

// Filter by sensitivity and retrieve a collection of appointments by using the item view.
String SearchFilterValue = Sensitivity.Private.ToString();
SearchFilter.IsEqualTo filter = new SearchFilter.IsEqualTo(AppointmentSchema.Sensitivity, SearchFilterValue);
FindItemsResults<Item> appointments = calendar.FindItems(filter, cView);
foreach (Appointment a in appointments)
{
    if (a.Sensitivity == Sensitivity.Private)
    {
        // Do what you want with the matched item
    }
}
// ...... 
1
Keep in mind that EWS requires you provide the credentials, and, since you are working with an online mailbox, the data might be out of sync with what you see in Outlook. The data is there locally, you just need to bypass OOM with Extended MAPI or Redemption.Dmitry Streblechenko
Yes, I know, thank you. In my current situation it is an acceptable compromise.Hudgi

1 Answers

1
votes

This is by design. There is nothing special about these appointments, and their properties are still accessible using Extended MAPI (C++ or Delphi). If using Redemption is an option (it wraps Extended MAPI and can be used from any language), its RDOAppointment object (which can be retrieved from RDOFolder) will return all available properties.

Can you see the data on the MAPI level if you look at it using OutlookSpy (click IMessage button or click IMAPIFolder button and open the appointments from the GetContentsTable tab)?