Working with usercontrols

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

Working with usercontrols
 
Jon Edmiston




Posts: 17
Joined: 2008-01-15
How do you get access to the OutlookApp object from inside a usercontrol. I'm trying to get access to the current item from a taskpane in Outlook.
Posted 15 Jan, 2008 13:06:20 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Hi Jon.

You can use the following code to access the addinmodule:
(AddinExpress.MSO.ADXAddinModule.CurrentInstance as AddinModule).OutlookApp
Posted 15 Jan, 2008 14:03:10 Top
Jon Edmiston




Posts: 17
Joined: 2008-01-15
Thanks! When I add in the 2 line below:

Outlook.Inspector ins = (AddinExpress.MSO.ADXAddinModule.CurrentInstance as AddinModule).OutlookApp.ActiveInspector();

Outlook.MailItem m = ins.CurrentItem as Outlook.MailItem;

I get the exception:
Detailed technical information follows:
---
Date and Time: 1/15/2008 11:34:42 AM
Machine Name: CCV07-L001
IP Address: fe80::a1e3:4093:91e5:1052%17
Current User: CCV\jedmiston

Application Domain: C:\Projects2005\RandD\ArenaOutlookAddInTest\ArenaOutlookAddInTest\bin\Debug\
Assembly Codebase: file:///C:/Windows/assembly/GAC_MSIL/AddinExpress.MSO.2005/4.0.1900.2005__4416dd98f0861965/AddinExpress.MSO.2005.dll
Assembly Full Name: AddinExpress.MSO.2005, Version=4.0.1900.2005, Culture=neutral, PublicKeyToken=4416dd98f0861965
Assembly Version: 4.0.1900.2005
Assembly Build Date: 3/15/2005 1:06:50 AM

Exception Source:
Exception Type: System.Runtime.InteropServices.COMException
Exception Message: Unable to create specified ActiveX control.
Exception Target Site: ForwardCallToInvokeMember

---- Stack Trace ----
System.RuntimeType.ForwardCallToInvokeMember(memberName As String, flags As BindingFlags, target As Object, aWrapperTypes As Int32[], msgData As MessageData&)
AddinExpress.MSO.2005.dll: N 0195 (0xC3) IL
AddinExpress.MSO.ICTPFactory.CreateCTP(CTPAxID As String, CTPTitle As String, CTPParentWindow As Object)
AddinExpress.MSO.2005.dll: N 00000 (0x0) JIT
AddinExpress.MSO.ADXAddinModule.AddCustomTaskPanes(parent As Object, outlookFolderName As String)
AddinExpress.MSO.2005.dll: N 0000 (0x0) IL


[CODE]
Posted 15 Jan, 2008 14:18:45 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Jon, please check if you set the task pane type correctly in the ControlProgID proeprty.
Posted 15 Jan, 2008 14:28:08 Top
Jon Edmiston




Posts: 17
Joined: 2008-01-15
Looks to be set correctly. It's the name of the user control (the only option in the drop down). If I comment out the 2 lines above everything runs fine. I appreciate all your help.
Posted 15 Jan, 2008 15:50:45 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Hi Jon.

Please send me the project. I will test it.
Posted 16 Jan, 2008 05:01:11 Top
Jon Edmiston




Posts: 17
Joined: 2008-01-15
What's your e-mail?
Posted 16 Jan, 2008 10:18:24 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Jon, I have just sent you an email.
Posted 16 Jan, 2008 10:52:26 Top