'Identifying the Inbox folder through IMAP

I have connected to an email Store via IMAP (outlook.office365.com). I can work out which folders to use for deleted, spam, outbox and so on, using the LIST command which passes back flags that I can use.

The question is, "how do I know what to use for the InBox". I could just hard-code the name, but that seems likely to fail rapidly. I am sure I am missing something, because if the other folders are tagged, then "inbox" would be a strange omission.

Looking forward to your help. Thanks.

PS - I am doing this with the Java Mail API if that makes a difference to the response.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source