c# - EWS Search Appointment Body for Substring -
i need search substring in user's calendar appointments. don't have other information appointment (guid, start date, etc.). know particular substring in body.
i've read couple articles on how body of appointment, search guid or subject. i'm trying use code below search substring in body, error can't use body in finditems
.
is there way this? assuming there's no way me other info appointment, there approach can take?
//variables itemview view = new itemview(10); view.propertyset = new propertyset(emailmessageschema.body); searchfilter sfsearchfilter; finditemsresults<item> findresults; foreach (string s in substrings) { //search messages body containing our permurl sfsearchfilter = new searchfilter.containssubstring(emailmessageschema.body, s); findresults = service.finditems(wellknownfoldername.calendar, sfsearchfilter, view); if (findresults.totalcount != 0) { item appointment = findresults.firstordefault(); appointment.setextendedproperty(extendedpropertydefinition, s); }
so turns out able search body, can't return body finditems
. have load later if want use it. instead of setting property set body, set idonly
, set searchfilter
traverse body of itemschema
.
//return 1 result--there should 1 in case itemview view = new itemview(1); view.propertyset = new propertyset(basepropertyset.idonly); //variables searchfilter sfsearchfilter; finditemsresults<item> findresults; //for each string in list foreach (string s in permurls) { //search itemschema.body string sfsearchfilter = new searchfilter.containssubstring(itemschema.body, s); findresults = service.finditems(wellknownfoldername.calendar, sfsearchfilter, view); if (findresults.totalcount != 0) { item appointment = findresults.firstordefault(); appointment.setextendedproperty(extendedpropertydefinition, s); ... appointment.load(new propertyset(itemschema.body)); string strbody = appointment.body.text; } }
Comments
Post a Comment