Skip to content
Advertisement

What is the deleted folder name link for Outlook?

I have a code snippet for deleting emails from Gmail. But I need to change that line store.getFolder("[Gmail]/Trash"); to work with the Outlook server. What is the deleted(trash) folder name link for Outlook?

store = session.getStore("imaps");
store.connect("imap.gmail.com",<username>,<password>);
inbox = store.getFolder("Inbox");
inbox.open(Folder.READ_WRITE);
deletedMessages.add(message);
message.setFlag(Flag.SEEN,true);
if (inbox.isOpen()) {
    if(deletedMessages.size() > 0){
        trash = store.getFolder("[Gmail]/Trash");
        Message[] tempMessageArray = deletedMessages.toArray(new Messag                    e[deletedMessages.size()]);
        inbox.copyMessages(tempMessageArray,trash);
        deletedMessages.clear();
 }
 inbox.close(true);

Answer

In Outlook, there are two options:

Outlook menu bar

So you could use [Outlook]/Deleted Items or [Outlook]/Junk Email. Probably most comparable to [Gmail]/Trash is [Outlook]/Deleted Items. Junk Email catches additional Spam email not blocked by Outlooks filters.

For more info, see : https://support.microsoft.com/en-us/office/working-with-message-folders-in-outlook-com-6bb0723a-f39f-4a8d-bb3f-fab5dcc2510a#:~:text=In%20the%20folder%20pane%2C%20right%2Dclick%20the%20folder%20you%20want,the%20folder%20and%20press%20Enter.

Advertisement