I\'m trying to implement and use Exchange Web Services on Android. I found this post and I proceed the same way by installing the Microsoft\'s EWS API JAVA:
http
There's a commercial ActiveSync library available @ JWebServices for java and android. Download JWebServices for Exchange in that page. Once you download , Just add jwebservices-1.1.jar jar file to ur project and u just have to provide the info while creating the Service object in ur code, as shown below. It worked in my android app.
Service service = new Service(
"https://mail.yourdomain.com/ews/Exchange.asmx",
"emailid@yourdomain.com", "password");
Here is the example code to display the appointments between current time and next 12 hours.
Service service = new Service(
"https://mail.yourdomain.com/ews/Exchange.asmx",
"emailid@yourdomain.com", "password");
Date startDate = new Date(System.currentTimeMillis());
Date endDate = new Date(System.currentTimeMillis()
+ (12 * 60 * 60 * 1000));
CharSequence startTime = DateFormat.format(
"yyyy-MM-dd HH:mm:ss", startDate);
CharSequence endTime = DateFormat.format("yyyy-MM-dd HH:mm:ss",
endDate);
IsGreaterThanOrEqualTo restriction1 = new IsGreaterThanOrEqualTo(
AppointmentPropertyPath.START_TIME,
startTime.toString());
IsLessThanOrEqualTo restriction2 = new IsLessThanOrEqualTo(
AppointmentPropertyPath.END_TIME, endTime.toString());
And restriction3 = new And(restriction1, restriction2);
FindItemResponse response = service.findItem(
StandardFolder.CALENDAR,
AppointmentPropertyPath.getAllPropertyPaths(),
restriction3);
int numberOfItems = response.getItems().size();
if (numberOfItems <= 0)
Log.v(">>><<<<", "There are no Appointments..");
for (int i = 0; i < numberOfItems; i++) {
if (response.getItems().get(i) instanceof Appointment) {
Appointment appointment = (Appointment) response
.getItems().get(i);
String logicalRoomName = null, location = appointment
.getLocation();
Log.v(">>><<<<", "Location = " + location);
Log.v(">>><<<<",
"Subject = " + appointment.getSubject());
Log.v(">>><<<<",
"StartTime = " + appointment.getStartTime());
Log.v(">>><<<<",
"EndTime = " + appointment.getEndTime());
Log.v(">>><<<<",
"Body Preview = "
+ appointment.getBodyPlainText()); } }