Unhandled Exception

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

Unhandled Exception
 
Jigar




Posts: 7
Joined: 2009-11-25
Hi,
We are getting this exception fr om clients which I m not able to explain. We have made a Outlook addin and are using Web View Panes and custom forms (as prescribed by add in express).

Message: Value of '-2147483457' is not valid for 'red'. 'red' should be greater than or equal to 0 and less than or equal to 255.

Source: AddinExpress.OL.2005\nStackTrace: at AddinExpress.Extensions.ADXExceptionManager.DoError(Exception e, Object sender, String wh ereHappened) at AddinExpress.Extensions.AdxSplitter.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

TargetSite: Void DrawSplitter()
Posted 25 Nov, 2009 00:25:17 Top
Andrei Smolin


Add-in Express team


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

What Add-in Express build are you using?


Andrei Smolin
Add-in Express Team Leader
Posted 25 Nov, 2009 06:17:07 Top
Jigar




Posts: 7
Joined: 2009-11-25
Add-in Express 2009 for .NET
and version for AddinExpress.MSO.2005.dll is 5.0.2019.2005 and runtime version is v2.0.50727
and version of AddinExpress.OL.2005 is 5.0.1186.2005 and runtime version is v2.0.50727
Posted 25 Nov, 2009 06:52:45 Top
Andrei Smolin


Add-in Express team


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

Oh, now I understand. That problem was fixed in July. I'd recommend to install the latest build, see the Downloads section of the web site.


Andrei Smolin
Add-in Express Team Leader
Posted 25 Nov, 2009 10:11:35 Top
Jigar




Posts: 7
Joined: 2009-11-25
Hi Andrei,
Thanks for the response. I have upgraded to the latest build.
I am having another problem with Outlook add-in.
When we try to display custom form by first switching to outbox folder and then current folder using following line of code,

Explorer.GetType().InvokeMember("SelectFolder", BindingFlags.InvokeMethod, Nothing, Explorer, New Object() {Folder})

we get following exception

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80020005): Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))

And strangely this happens only on a system with Vista OS and Outlook 2007 with2 other add-ons installed namely Business Contacts Manager and GoToMeeting

On other systems it is working fine.

Please let me know if there is any solution to this problem.
Posted 26 Nov, 2009 06:08:00 Top
Andrei Smolin


Add-in Express team


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

Please see the following sample http://www.add-in-express.com/support/addin-c-sharp.php#form-regions.

If however, you need to switch to the Outbox (I don't understand why, however), then try disabling those add-ins. if the error persists, please let me know.


Andrei Smolin
Add-in Express Team Leader
Posted 26 Nov, 2009 07:39:55 Top
Jigar




Posts: 7
Joined: 2009-11-25
Hi Andrei,

We were using outbox folder technique to refresh the view as described in SwitchingWebViewPaneVs2005cs demo project.
In our add-in, ADXOlFormsCollectionItem 's ExplorerLayout property is set to "WebViewPane" - so we thought we have to use outbox technique to refresh the view when the user switches between custom form and normal outlook view.

In the example you gave above, the ExplorerLayour is BottomSubPane and the form's visibility is controlled by show and hide methods. I m not sure if that approach will work with WebViewPane also. Let me know if there is any other way out.

Regards,
Jigar
Posted 27 Nov, 2009 02:01:44 Top
Fedor Shihantsov


Guest


Hi Jigar,

Could you please create a simple add-in with one CommandBar button, test your code

Explorer.GetType().InvokeMember("SelectFolder", BindingFlags.InvokeMethod, Nothing, Explorer, New Object() {Folder})


by clicking on this button in Vista/Office 2007 and let me know about the result?
Posted 30 Nov, 2009 08:44:05 Top
Jigar




Posts: 7
Joined: 2009-11-25
Hi Fedor,

It does work then.

Here is what we are doing to give you a better idea.

1. On Initialize event we create a new folder within Inbox or get the EntryID of that folder if it already exists.
2. Then whenever the user clicks on our button, we first set our folder as current folder by using following code:

Dim activeExplorer As Outlook.Explorer = OutlookApp.ActiveExplorer()
Dim mapiNameSpace As Outlook.NameSpace = OutlookApp.GetNamespace("MAPI")
Dim ourFolder As Outlook.MAPIFolder = Nothing
Try
If Not String.IsNullOrEmpty(OurFolderId) Then
ourFolder = mapiNameSpace.GetFolderFromID(OurFolderId)
If ourFolder IsNot Nothing Then
SetExplorerFolder(activeExplorer, ourFolder )
System.Windows.Forms.Application.DoEvents()
End If
End If
Finally
If mapiNameSpace IsNot Nothing Then
Marshal.ReleaseComObject(mapiNameSpace)
End If
If ourFolder IsNot Nothing Then
Marshal.ReleaseComObject(ourFolder )
End If
If activeExplorer IsNot Nothing Then
Marshal.ReleaseComObject(activeExplorer)
End If
End Try

3. Then we call the following code. Here RefreshCurrentFolder() is same as in SwitchingWebViewPaneVs2005cs demo

AdxOlFormsCollectionItem2.FolderName = GetFullNameOfCurrentFolder()
RefreshCurrentFolder()

4. We get the error in RefreshCurrentFolder() when a call to SetExplorerFolder() is made

If we skip the step 2, we do not get error. But step 2 works fine in most systems.
Posted 01 Dec, 2009 01:56:20 Top
Fedor Shihantsov


Guest


Hi Jigar,

Could you please disable the Business Contacts Manager and GoToMeeting add-ins and let me know does if the exception appears?

Could you please sent the sample add-in with the same issue to our support email so that we can reproduce and research the issue?
Posted 02 Dec, 2009 05:02:14 Top