I have an Outlook add-on and now I need to add a button on this ribbon for when a user clicks the button, it would allow me to retrieve the current selected email's body. I created this code but it's only retrieving the first email in my inbox because the index is 1. Here's the code:
Microsoft.Office.Interop.Outlook.Application myApp = new Microsoft.Office.Interop.Outlook.Application();
Microsoft.Office.Interop.Outlook.NameSpace mapiNameSpace = myApp.GetNamespace("MAPI");
Microsoft.Office.Interop.Outlook.MAPIFolder myInbox = mapiNameSpace.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox);
String body = ((Microsoft.Office.Interop.Outlook.MailItem)myInbox.Items).Body;
So how can I retrieve the current email that's opened in Outlook? Thanks!