Doing simple things to make great life

Delete Email item in Exchange Server EWS

Posted by kalaimaan on February 10, 2009

Delete Email Item In Exchange Server using Java Stub interface

The below code is use to delete the particular item of email

* @param id
* @param key
* @return
private String deleteMessageItem(String id, String key)
String status = “Error”;

DeleteItemType deleteItemType = DeleteItemType.Factory.newInstance();

NonEmptyArrayOfBaseItemIdsType arrayOfBaseItemIdsType = NonEmptyArrayOfBaseItemIdsType.Factory.newInstance();
ItemIdType[] itemIdType = new ItemIdType[1];
itemIdType[0] = ItemIdType.Factory.newInstance();

DeleteItemDocument deleteItemDocument = DeleteItemDocument.Factory.newInstance();

DeleteItemResponseDocument deleteItemResponseDocument = null;
deleteItemResponseDocument = exService.DeleteItem(deleteItemDocument, null, null, null, null);
catch (RemoteException e)
return status;

DeleteItemResponseType deleteItemResponseType = deleteItemResponseDocument.getDeleteItemResponse();

ResponseMessageType[] responseMessageType = deleteItemResponseType.getResponseMessages()

for (int i = 0; i < responseMessageType.length; i++)
if (responseMessageType[i].getResponseClass() == ResponseClassType.SUCCESS)
status= “Success”;
else if (responseMessageType[i].getResponseClass() == ResponseClassType.ERROR)
status= “Error”;

return status;


One Response to “Delete Email item in Exchange Server EWS”

  1. Find some private amateur stuff…

    […]Delete Email item in Exchange Server EWS « Kalaimaan[…]…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: