Accessing folder attributes from property page in folder properties dialog in Outlook

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

Accessing folder attributes from property page in folder properties dialog in Outlook
 
M Garber




Posts: 14
Joined: 2010-06-22
Hello,
I have created a property page and successfully added it to the folder properties dialog, but I couldn't find any way to access the folder I'm on. i.e., if I right click Inbox and select Properties, I don't know how to know I'm in the inbox.
I'm sure this should be easy, but I couldn't find a way to do it either in any code sample or any how to. Can anyone help me?

Thanks in advance.
---
Technical information:
Add-in Express 2010 for Office and .NET
Outlook 2007 / Outlook 2003
VS2008 SP1
WinXP SP2
Posted 22 Jun, 2010 12:23:04 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hi Matias,

OutlookApp.ActiveExplorer().CurrentFolder. But note that all COM objects created by this code line must be released, please see http://www.add-in-express.com/creating-addins-blog/2008/10/30/releasing-office-objects-net/


Andrei Smolin
Add-in Express Team Leader
Posted 22 Jun, 2010 12:31:45 Top
mgarber




Posts: 14
Joined: 2010-06-22
Andrei,
Where do I get OutlookApp from? The property page won't recognize it (at least on the Load event).
Thanks.
---
Technical information:
Add-in Express 2010 for Office and .NET
Outlook 2007 / Outlook 2003
VS2008 SP1
WinXP SP2
Posted 22 Jun, 2010 12:47:10 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Matias,

My fault. (AddinExpress.MSO.ADXAddinModule.CurrentInstance as MyAddin1.AddinModule).OutlookApp ....


Andrei Smolin
Add-in Express Team Leader
Posted 22 Jun, 2010 12:54:58 Top
mgarber




Posts: 14
Joined: 2010-06-22
I see, thanks.
Another question: in VSTO, the MAPIFolder interface has a UserDefinedProperties attribute. In Add-in Express, how do I access that?
---
Technical information:
Add-in Express 2010 for Office and .NET
Outlook 2007 / Outlook 2003
VS2008 SP1
WinXP SP2
Posted 22 Jun, 2010 13:26:17 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Matias,

That property/interface was introduced in Outlook 2007 (see http://office.microsoft.com/en-us/outlook-help/HV080801667.aspx?origin=HV080804590). And you saw it because you used PIA for Outlook 2007 or Outlook 2010. With Add-in Express you use version-neutral interops by default; in case of Outlook, this is an interop for Outlook 2000.

You have two choices. You can replace version-neutral interops with primary interops for Office 2007. Also, in the code, you can check the version of the Outlook.Application which has loaded your add-in and if the version starts with "12.0" or "14.0", you can call that property via late binding, see System.Type.InvokeMeber in MSDN or search through this forum. I'd also suggest that you read http://www.add-in-express.com/creating-addins-blog/2010/03/16/interop-assemblies-late-binding/


Andrei Smolin
Add-in Express Team Leader
Posted 23 Jun, 2010 06:31:59 Top