COMException in Outlook Addins referenced with SuperOffice com-based dll

Hi,

I try to write in VisualStudio Outlook addins to synchronize appointments between Outlook above 2010 and SuperOffice 7 what it till now doesn't support.

referenced are both com-based SuperOffice DLLs in my addins with wpf Usercontrol: SOCRM.Interop.dll and SuperOfficeDB.Interop.dll both in Version 7.1.4816.100 for SO 7.1 SR2 Windows. But by debuging in Outlook it posts error with COMException in User Interface at:

sodb.Login(soApp.Database.SafeCredentials, soApp.Database.SafeCredentials)

to logon SO current User by running Superoffice, see pls. screenshot.

SO COMException in User Interface

 

SO COMException in visualStudio code

here is error description:

************** Exception Text **************
System.Runtime.InteropServices.COMException (0xC101014D): Authentication failed!
Authentication failed!
Object reference not set to an instance of an object.
   at SuperOffice.COM.SuperOfficeDB.IDatabase.Login(String Username, String Password)
   at diaryLink.myStart.FrmStart_Load(Object sender, EventArgs e) in C:\Users\you\Documents\Visual Studio 2015\Projects\diaryLink\diaryLink\myStart.xaml.vb:line 27
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
   at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
   at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root)
   at MS.Internal.LoadedOrUnloadedOperation.DoWork()
   at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()
   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   at System.Windows.Media.MediaContext.Resize(ICompositionTarget resizedCompositionTarget)
   at System.Windows.Interop.HwndTarget.OnResize()
   at System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

Could you pls. help to check whether anything is wrong in my Implementation, thakns a lot!

 

- Jianchun

RE: COMException in Outlook Addins referenced with SuperOffice com-based dll

Hard to see your code from the screen capture..

Is soApp good?
If so, why bother instantiating a SuperOfficeDB.Database
Just use soApp.Database.

I know nothing about Oulook AddIns, sorry, but here are a few things:

Make sure the COM components have been properly registered.
Using SuperOfficeDB can only happen from a 32Bit process.
SoApplication can be used from a 64 bit process (involves marchalling).

/conrad

Af: Conrad Weyns 29. mar 2017

RE: COMException in Outlook Addins referenced with SuperOffice com-based dll

Hi dear Conrad,

 

yes you are right, it works also without SuperOfficeDB, all object data comes from SoApp.database.

 

Thanks a lot!

 

- Jianchun

 

Af: Jianchun You 30. mar 2017

RE: COMException in Outlook Addins referenced with SuperOffice com-based dll

Nice to hear.

My guess is that either your SuperOfficeDB.dll is not properly registered or you are in a 64bit process.

There is a difference between using the Application instance and the SuperOfficeDb instance.
The former always involves marchalling which is why it works from a 64 bit process.
It will be slower but you get the benifit of live-update.

The latter will be loaded inside a hosting 32 bit process. No marchalling is involved. So it will be faster. But then again, you pay for a very slow logon and off course, socrm will have no idea of what you are doing in the background..

My advice is use the Application instance whenever possible.
Conrad

Af: Conrad Weyns 30. mar 2017

RE: COMException in Outlook Addins referenced with SuperOffice com-based dll

Yes we have 64-bit Windows system, and in VisualStudio on the setting of target-CPU of my Outlook Addins is x86, i think that could be problem with SuperOfficeDb instance.

But today there is almost all pc with 64-bit and cannot image why SuperOfficeDb still only works on 32-bit. Good, with your advice we got over now with this isses.

- Jianchun

Af: Jianchun You 30. mar 2017