Here is my code for obtaining some calendar items (appointments) from EWS. But this throws an exception all the time.
The Exception:- The property can not be used with this type of restriction.
private void GetChangedAppointmentInformation(Appointment appointment)
{
try
{
// Save appointment details into local variables
id = appointment.Id.ToString();
body = appointment.Body;
duration = appointment.Duration;
end = appointment.End;
bookingKey = appointment.Subject;
subject = appointment.Subject;
location = appointment.Location;
ItemView view = new ItemView(1000);
// Create a search filter that filters email based on the existence of the extended property.
SearchFilter eq = new SearchFilter.IsEqualTo(AppointmentSchema.ICalUid, appointment.ICalUid);
// Search the Calendar with the defined view and search filter. This results in a FindItem operation call to EWS.
FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Calendar, eq, view);
}
catch (Exception ex)
{
Console.WriteLine("Error: " + ex.Message);
}
}
Can you please advise me on this? I tried MSDN and several other online resources, I'm still trying to figure that out.
The error is telling you that the strongly typed property you're trying to use can't be used in a restriction. The best workaround for this is to use the equivalent Extended Property instead eg to search based on a existing appointment something like
Should work okay
Cheers Glen