I have created a mail app (Office 365) for outlook, in JavaScript API at what point we can get the information of selected folder.
Basically I have created ReadMail app for which I need to have information of folder so that I can perform logic based on folder selection.
Use makeEWSRequestAsync API to do a getItem EWS SOAP request which give you information about the selected message for which your mail app activated. Using getItem, you can get the message parent folder and get more information about it. https://msdn.microsoft.com/en-us/library/office/fp161019.aspx