Moyosoft Products | Services | Download | Contact us    
Java Outlook Connector
Products  >  Java Outlook Connector  >  API Reference    
API Reference
   
Overview  |  
Classic JavaDoc

OutlookItem.delete

public void delete()

Delete this item.

Returns:
true if the operation was successful; false otherwise.

Throws:
ComponentObjectModelException   

Community comments


Deleting permanently
Vote up  |  Vote down
The delete() method moves the item to the Trash folder.

Use the method ItemsCollection.remove(int index) to remove the item from the folder without moving it to the Trash.

isDeleted
Vote up  |  Vote down
To check if an item is deleted, have to find out if it's stored in the Deleted Items folder:

    private static boolean isDeleted(Outlook outlook, OutlookItem item)
    {
        OutlookFolderID trashFolderId =
                outlook.getDefaultFolder(FolderType.DELETED_ITEMS).getFolderId();

        OutlookFolder parentFolder = item.getParentFolder();

        while(parentFolder != null)
        {
            if(parentFolder.getFolderId().equals(trashFolderId))
            {
                return true;
            }
            
            parentFolder = parentFolder.getParentFolder();
        }
        
        return false;
    }


Powered by JavaDocPlus