Home > Back-end >  What is the deleted folder name link for Outlook?
What is the deleted folder name link for Outlook?

Time:07-27

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);

CodePudding user response:

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 the folder pane, right-click the folder you want,the folder and press Enter.

  • Related