c# - Exchange WebService EWS FindAppointmens 501: Not Implemented -
we have exchange server 2010 sp2 running here on premise. i'm using ews managed api (i've tried both api/dll version 1.2 , 2.1) connect it. i'm able retrieve calendar, ews service name , version info, on line "var appointments = calendar.findappointments(calenderview);
" 501 - not implement exception (see image).
i've searched net can't find info on error, nor find info on msdn. below code use:
main method:
private void main_load(object sender, eventargs e) { connectwithexchange(); getcalendaritems(); }
instantation
/// <summary> /// http://msdn.microsoft.com/en-us/library/office/ff597939(v=exchg.80).aspx /// </summary> private void connectwithexchange() { // 01. instantiate exchangeservice _exchange = new exchangeservice(exchangeversion.exchange2010_sp2); // 02. connect credentials _exchange.usedefaultcredentials = true; // or pass through credentials of service user: // _exchange.credentials = new webcredentials("user@name", "password", "domain"); // 03. set correct endpoint // http://msdn.microsoft.com/en-us/library/office/gg274410(v=exchg.80).aspx // _exchange.url = new uri("https://outlook.kdg.be/ews/exchange.asmx"); // or use autodiscover _exchange.autodiscoverurl("name@domain.com"); // works ok // 04. display version , info uxexchangeversion.text = _exchange.url.tostring(); // works ok }
retrieving calendar items
/// <summary> /// http://msdn.microsoft.com/en-us/library/office/dn439786(v=exchg.80).aspx /// </summary> private void getcalendaritems() { // 01. init calendar folder object folder id calendarfolder calendar = calendarfolder.bind(_exchange, wellknownfoldername.calendar, new propertyset(folderschema.displayname)); // 02. set start , end time , number of appointments retrieve calendarview calenderview = new calendarview(datetime.now, datetime.now.adddays(7), 150); // 03. limit properties returned calenderview.propertyset = new propertyset(appointmentschema.subject, appointmentschema.start, appointmentschema.end); // 04. fetch appointments var appointments = calendar.findappointments(calenderview); // var appointments = _exchange.findappointments(calendar.id, new calendarview(datetime.now, datetime.now.adddays(7))); // **failure point** // 05. display appiontments in list // 05a. fetch calender name uxcalendername.text = calendar.displayname + " (" + calendar.id.mailbox + ")"; // 05b. fill list uxappointments.items.clear(); foreach (var appointment in appointments) { var appointmentstring = new stringbuilder(); appointmentstring.append("subject: " + appointment.subject.tostring() + " "); appointmentstring.append("start: " + appointment.start.tostring() + " "); appointmentstring.append("end: " + appointment.end.tostring()); uxappointments.items.add(appointmentstring.tostring()); } }
i ran getcalendaritems() , works fine me. noticed don't have url redirection callback in _exchange.autodiscoverurl. i'm surprised can url without redirection.
internal static bool redirectionurlvalidationcallback(string redirectionurl) { // default validation callback reject url. bool result = false; uri redirectionuri = new uri(redirectionurl); // validate contents of redirection url. in simple validation // callback, redirection url considered valid if using https // encrypt authentication credentials. if (redirectionuri.scheme == "https") { result = true; } return result; }
can tell me target server? version of exchange targeting?
Comments
Post a Comment