Reputation: 179
I am trying to search appointment by Required Attendees...but below code is not working. Any idea on how to implement this search. Thanks in advance
var Filter = new SearchFilter.SearchFilterCollection(LogicalOperator.Or)
{
new SearchFilter.ContainsSubstring(AppointmentSchema.RequiredAttendees, mailAddress),
new SearchFilter.ContainsSubstring(AppointmentSchema.OptionalAttendees, mailAddress),
};
var view = new ItemView(1000)
{
PropertySet = new PropertySet(BasePropertySet.FirstClassProperties)
};
FindItemsResults<Item> results = ews.FindItems(WellKnownFolderName.Calendar, Filter, view);
Upvotes: 0
Views: 510
Reputation: 22032
That isn't a supported filter because the Attendees (or really just the recipients) is a collection and SearchFilters can't be used on those type of structures. The closest thing you can do is use AQS and search on the participants
string queryString = "Participants:[email protected]";
FindItemsResults<Item> results = ews.FindItems(WellKnownFolderName.Calendar, queryString, view);
That will Participants includes optional attendees but you can just filter the excess appointments you get back at the client side.
Upvotes: 1