Hi Team,
We're using ews service for getting the appointments from exchange. We're checking a condition before proceeding with our functionality that the appointment object MyResponseType property is Organizer or not. The appointment was created and updated by one
of our client who is using office 365 account. And now we have experienced an issue in binding the appointments to our system and when we analysed the issue in detail, we understand that some of the appointments MyResponseType property is "Unknown"
ans since it is not invoking our further functionality. I will attach some of the code segments below. Kindly check the same and let us know your thoughts on the same. As I mentioned the following condition "if
(appointment.MyResponseType == MeetingResponseType.Organizer)" is breaking our functionality.
Microsoft.Exchange.WebServices.Data.ExchangeService service = new Microsoft.Exchange.WebServices.Data.ExchangeService(ExchangeVersion.Exchange2016);
service.Url = new Uri("https://outlook.office365.com/ews/Exchange.asmx");
service.Credentials = new NetworkCredential(mailaddress, password);
PropertySet propertySet = new PropertySet(PropertySet.FirstClassProperties.BasePropertySet, ItemSchema.MimeContent)
{
RequestedBodyType = BodyType.Text
};
SearchFilter.IsGreaterThanOrEqualTo restrictionStartDate = new SearchFilter.IsGreaterThanOrEqualTo(AppointmentSchema.Start, startdate.Date);
SearchFilter.IsGreaterThanOrEqualTo restrictionEndDate = new SearchFilter.IsGreaterThanOrEqualTo(AppointmentSchema.End, startdate.Date);
SearchFilter.SearchFilterCollection restrictionAppointments = new SearchFilter.SearchFilterCollection(Microsoft.Exchange.WebServices.Data.LogicalOperator.Or);
restrictionAppointments.Add(restrictionStartDate);
restrictionAppointments.Add(restrictionEndDate);
ItemView view = new ItemView(1000, 0, Microsoft.Exchange.WebServices.Data.OffsetBasePoint.Beginning);
var calenderItems = service.FindItems(WellKnownFolderName.Calendar, restrictionAppointments, view);
for (int i = 0; i < calenderItems.Items.Count; i++)
{
if (calenderItems.Items[i] is Microsoft.Exchange.WebServices.Data.Appointment)
{
'''
var appointment = (Microsoft.Exchange.WebServices.Data.Appointment)calenderItems.Items[i];
appointment = Microsoft.Exchange.WebServices.Data.Appointment.Bind(service, appointment.Id, propertySet);
if (appointment.MyResponseType == MeetingResponseType.Organizer)
{
...
}
}
}