Problems with Outlook when Words is default editor

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

Problems with Outlook when Words is default editor
 
Martin Rowan




Posts: 9
Joined: 2006-03-03
I've create an add-in for outlook that allows the users to send and email add it to a specific project within our in-house application.

The add-in works fine when use Word 2003 as editor is unchecked in the Tools -> Options ->mail format section.

But when this checkbox is selected i get the following Warning message

DragDrop registration failed.

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.InvalidOperationException: DragDrop registration failed. ---> System.Threading.ThreadStateException: The current thread must set to Single Thread Apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it.
at System.Windows.Forms.Control.SetAcceptDrops(Boolean accept)
--- End of inner exception stack trace ---
at System.Windows.Forms.Control.SetAcceptDrops(Boolean accept)
at System.Windows.Forms.Control.OnHandleCreated(EventArgs e)
at System.Windows.Forms.DataGrid.OnHandleCreated(EventArgs e)
at System.Windows.Forms.Control.WmCreate(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
EmailModule
Assembly Version: 1.0.2253.25910
Win32 Version: 1.0.2253.25910
CodeBase: file:///C:/Program%20Files/Streamline%20Email%20Module/EmailModule.DLL
----------------------------------------
AddinExpress.MSO
Assembly Version: 2.2.1752.1437
Win32 Version: 2.2.1752.1437
CodeBase: file:///c:/windows/assembly/gac/addinexpress.mso/2.2.1752.1437__c20c070a1fc9a144/addinexpress.mso.dll
----------------------------------------
System.Configuration.Install
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system.configuration.install/1.0.5000.0__b03f5f7f11d50a3a/system.configuration.install.dll
----------------------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
Extensibility
Assembly Version: 7.0.3300.0
Win32 Version: 7.00.9466
CodeBase: file:///c:/windows/assembly/gac/extensibility/7.0.3300.0__b03f5f7f11d50a3a/extensibility.dll
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
Office
Assembly Version: 7.0.3300.0
Win32 Version: 7.00.9466
CodeBase: file:///c:/windows/assembly/gac/office/7.0.3300.0__b03f5f7f11d50a3a/office.dll
----------------------------------------
stdole
Assembly Version: 7.0.3300.0
Win32 Version: 7.00.9466
CodeBase: file:///c:/windows/assembly/gac/stdole/7.0.3300.0__b03f5f7f11d50a3a/stdole.dll
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 7.0.5000.0
Win32 Version: 7.10.6001.4
CodeBase: file:///c:/windows/assembly/gac/microsoft.visualbasic/7.0.5000.0__b03f5f7f11d50a3a/microsoft.visualbasic.dll
----------------------------------------
SecurityManager
Assembly Version: 1.5.1706.0
Win32 Version: 1.5.1706.0
CodeBase: file:///c:/windows/assembly/gac/securitymanager/1.5.1706.0__0a70e3ed5f1a4e7d/securitymanager.dll
----------------------------------------
Microsoft.Office.Interop.Outlook
Assembly Version: 11.0.0.0
Win32 Version: 11.0.5530
CodeBase: file:///c:/windows/assembly/gac/microsoft.office.interop.outlook/11.0.0.0__71e9bce111e9429c/microsoft.office.interop.outlook.dll
----------------------------------------
System.Data
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system.data/1.0.5000.0__b77a5c561934e089/system.data.dll
----------------------------------------
Accessibility
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/accessibility/1.0.5000.0__b03f5f7f11d50a3a/accessibility.dll
----------------------------------------

************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging=\"true\" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.
_____________________________________________________________

But when you click continue on the exception dialog, the add-in works.

Any help is appreciated on this .... :cry:
Posted 03 Mar, 2006 10:22:09 Top
Sergey Grischenko


Add-in Express team


Posts: 7228
Joined: 2004-07-05
Hi Martin.

When exactly do you get this error? Do you use Drag and Drop technic on a windows form? How can I reproduce this issue?
Posted 06 Mar, 2006 07:08:14 Top
Martin Rowan




Posts: 9
Joined: 2006-03-03
Hi Sergey,

How to reproduce the error is as follows,

within Outlook, Tools -> Options
Under Mail Format Tab, make sure Use Microsoft word 2003 to edit e-mail messages is checked and the one below is checked.

Then ok or apply.

Once this is done, Create a new mail and once the new mail window open i click on the Add-on Functionality and i get the above error.

The add-on functionality connects to an access database to populate a windows form grid with a list of projects. Once the user selects a project the email is then associated to the specific problem.

Also, if the checkbox with the mail format tab are unchecked the functionality works, but some of our clients might use Word 2003 within there emails.

I'm not using the DragDrog technic directly as far as I'm aware. It seems to be an issue with the OLEDB connection to the access DB and Word 2003.

;)
Posted 07 Mar, 2006 04:05:27 Top
Sergey Grischenko


Add-in Express team


Posts: 7228
Joined: 2004-07-05
Hi Martin.

Probably the problem is in .NET controls. What control do you use to show the list of projects?
Posted 07 Mar, 2006 14:21:27 Top
Martin Rowan




Posts: 9
Joined: 2006-03-03
Hi Sergey,

The following are the list of controls that are on the form,

1) Label x 3
2) Textbox x 3
3) Checkbox x 2
4) Datagrid
5) Button x 3

That's it, do you reckon it could be something to do with the datagrid??

Thanks

Martin
Posted 08 Mar, 2006 04:03:40 Top
Sergey Grischenko


Add-in Express team


Posts: 7228
Joined: 2004-07-05
Hi Martin.

Yes, it could be a reason. Did you set the AllowDrop property of the datagrid to true?
Posted 08 Mar, 2006 16:53:15 Top
Martin Rowan




Posts: 9
Joined: 2006-03-03
Hi Sergey,

That did the trick, it's amazing how 1 setting can cause such big problems.

Thank you for your support

Martin :)
Posted 09 Mar, 2006 11:54:48 Top