Deleted appointments set as modify
After a getEvents() with a pull subscription, a deleted appointment is set as EventType.Modified. Then, when binding, an exception is thrown with a message that the item isn't found in the store.
For now, I'm assuming that an exception when binding to a modify means that it should have been a delete.
@nickersd can you provide a small code example that triggers the exception? Are you using the latest snapshot version?
I'd really like to get my hands dirty with this stuff but under the gun to get a prototype up and running of our calendar. This is what should be the relevant code:
//create pull subscription
List<FolderId> folder = new ArrayList<FolderId>(); folder.add(FolderId.getFolderIdFromWellKnownFolderName(WellKnownFolderName.Calendar));
logger.debug("creating pull subscription");
/* watermark: null to start a new subscription. May need to add event types, not sure what is needed for appointments*/
try {
subscription = service.subscribeToPullNotifications(folder, SUBSCRIPTION_TIMEOUT, null, EventType.Created, EventType.Deleted, EventType.Modified);
logger.debug("subscription id " + subscription.getId() + " created for user id " + exchangeUserName);
} catch (Exception e) {
logger.error("Error creating subscription for " + exchangeUserName + "\n" + e.getMessage());
}
........
//get items from exchange
for (ItemEvent itemEvent : events.getItemEvents()) {
if (itemEvent.getEventType() == EventType.Created) {
logger.debug("got a new appt");
Item item = Item.bind(service, itemEvent.getItemId());
OmCalAppts newAppt = new OmCalAppts((Appointment)item);
omCalApptsDao.insertAppointment(newAppt);
} else if (itemEvent.getEventType() == EventType.Deleted) {
logger.debug("got a deleted appt");
//Item item = Item.bind(service, itemEvent.getItemId());
//TODO: do we need a deleted flag for when the webapp syncs again?
// omCalApptsDao.deleteApptByExchangeId(item.getId().getUniqueId());
} else if (itemEvent.getEventType() == EventType.Modified) {
logger.debug("got a modified appt");
try {
Item item = Item.bind(service, itemEvent.getItemId());
omCalApptsDao.updateExchangeAppt((Appointment) item);
} catch (Exception e) {
logger.error(e.getMessage() + "\nError binding to modify, will assume it's a delete");
modifyError = true;
}
}
I have the same problem, is this problem solved? @serious6