exchangewebservices - Get calendaritem from Outlook -> there is an exception -
i exception
unhandled exception of type 'microsoft.exchange.webservices.data.servicelocalexception' occurred in microsoft.exchange.webservices.dll additional information: url property on exchangeservice object must set.
on:
..., new propertyset());. in
public void getews() { // initialize values start , end times, , number of appointments retrieve. //$service = new-object microsoft.exchange.webservices.data.exchangeservice([microsoft.exchange.webservices.data.exchangeversion]::exchange2013) exchangeservice service = new exchangeservice(exchangeversion.exchange2013); datetime startdate = datetime.now; datetime enddate = startdate.adddays(30); const int num_appts = 5; // initialize calendar folder object folder id. calendarfolder calendar = calendarfolder.bind(service, wellknownfoldername.calendar, new propertyset()); // set start , end time , number of appointments retrieve. calendarview cview = new calendarview(startdate, enddate, num_appts); // limit properties returned appointment's subject, start time, , end time. cview.propertyset = new propertyset(appointmentschema.subject, appointmentschema.start, appointmentschema.end); // retrieve collection of appointments using calendar view. finditemsresults<appointment> appointments = calendar.findappointments(cview); console.writeline("\nthe first " + num_appts + " appointments on calendar " + startdate.date.toshortdatestring() + " " + enddate.date.toshortdatestring() + " are: \n"); foreach (appointment in appointments) { console.write("subject: " + a.subject.tostring() + " "); console.write("start: " + a.start.tostring() + " "); console.write("end: " + a.end.tostring()); console.writeline(); } }
in code haven't set url ews use (which error telling you) , haven't set credentials use. see https://msdn.microsoft.com/en-us/library/office/dn509511%28v=exchg.150%29.aspx , https://msdn.microsoft.com/en-us/library/office/dn467891(v=exchg.150).aspx
cheers glen
Comments
Post a Comment