Getting the current MailItem on task pane

Add-in Express™ Support Service
That's what is more important than anything else

Getting the current MailItem on task pane
 
Nelson Fernandez


Guest


The samples I have seen show how to GetSubject from IExplorer and IInspector on their respective ribbons.

1) How do I get the same info from the task pane? It does not appear to have access to the OutlookApp object.

and

2) Is there a way to return the full email (incl. attachments) so it can be saved to a database or other location?
Posted 07 Feb, 2018 14:03:44 Top
Andrei Smolin


Add-in Express team


Posts: 18652
Joined: 2006-05-11
Hello Nelson,

1. You can create a global variable holding the Application object.
2. Call TMailItem.SaveAs() to save the file to a location of your choice.


Andrei Smolin
Add-in Express Team Leader
Posted 08 Feb, 2018 01:53:27 Top
Nelson Fernandez


Guest


Thank you. I have made the global variable and I can access it from task window but I'm wondering how do I determine if the task window is from an Inspector or from an Explorer?
Posted 08 Feb, 2018 18:12:24 Top
Andrei Smolin


Add-in Express team


Posts: 18652
Joined: 2006-05-11
Hello Nelson Fernandez,

Outlook.Explorer and Outlook.Inspector implement the IOLEWindow interface; you use this fact to find the hwnd of every explorer and inspector window. Then you can call GetAncestor passing it GA_ROOT to find the parent window that contains your UserControl (any control on your UserControl) and compare this hwnd with the handles retrieved on the previous step.


Andrei Smolin
Add-in Express Team Leader
Posted 09 Feb, 2018 07:31:06 Top