1

I have a normal windows forms program (Not VSTO) which deploys using click once. The issue is that loads of user are having problems with random errors generally stating (from the IClassFactory failed due to the following error: 80004005).

Im deploying Redemption by changing the mode to "Isolated" which appears to work for some users but not others.

The users that arn't working can be fixed by manually installing the Redemption DLL.

Can anyone explain how to automate the process (I really want it to be reg free so users don't need admin permission to install).

Thanks

Ross

Ross Dargan
  • 5,876
  • 4
  • 40
  • 53

3 Answers3

3

Got this resolved. The issue was I had loaded redemption objects on a background thread, and was trying to manipulate them on the UI thread. Ensure you are consistent when using the objects.

Ross Dargan
  • 5,876
  • 4
  • 40
  • 53
  • 1
    Always works better when trying to explain the problem :) I have answered quite a few of my questions. – leppie Jul 26 '09 at 14:47
2

It is entirely possible to use Redemption in background threads, if you do it correctly. The firsr RDOSession object you create, must be created in the UI thread, because some MAPI internals need for the message pump to have been created in the same thread. Typically this RDOSession should be kept for the lifetime of your app. You cannot access this object from any other thread.

You'll need to pass the MAPIOBJECT property of your first RDOSession to each worker thread, create a new RDOSessuion object from within each thread, and assign the MAPIOBJECT from your RDOSession to the secondary RDOSession created in the thread. Example:

(Aircode Warning: the code below was typed from memory.)

Dim PrimaryRDOSession As New Redemption.RDOSession()
PrimaryRDOSession.Login([...])
Dim WorkerThread as New System.Threading.Thread(AddressOf ThreadProc)
WorkerThread.Start(PrimaryRDOSession.MAPIOBJECT)

Sub ThreadProc(ByVal param as Object)
    Dim ThdRDOSession As New Redemption.RDOSession()
    ThdRDOSession.MAPIOBJECT = param
    ' do other stuff
End Sub

From there you can do anything you'd normally do with Redemption. You can pass EntryIDs between threads if Outlook objects are selected/located in one thread, and acted upon in another.

Mark McGinty
  • 756
  • 7
  • 13
-1

Outlook Redemption (Redemption.dll) and Background Threading do not mix.

Similar to your situation, we were logging into the Exchange Server using a background thread.

This lead to intermittent errors of Redemption not being able to log into Exchange.

Also, one of my colleagues had put an Email Pop call in a background thread and, again, sometimes it would work and sometimes it would not.

When using Redemption, always let the main UI thread handle it's operations.

Redemption does not really lock up the application as there are really no long running processes when popping an email, adding an appointment or even hooking into the Email Sent Redemption event to handle logging of information sent via email, etc.

ElMatador
  • 557
  • 1
  • 6
  • 15
  • 1
    You are mistaken. You can use Redemption from another thread. – The Muffin Man Dec 19 '14 at 18:21
  • Muffin man, I can only go by experience. Also, look at what the self resolution to this question was! I am surprised I did not get an up vote on this one! Geezz .. :) – ElMatador Feb 10 '18 at 07:28
  • We just rewrote part of our add-in to perform potentially slow MAPI operations on a background thread instead of blocking the UI thread as happens when using Outlook Object Model. I can assure you it can be done. – Søren Boisen Jan 08 '19 at 19:15
  • If each session object in a worker thread was separately logging in, you weren't doing it correctly, login once them pass the MAPIOBJECT property from the first session to connect the others. – Mark McGinty Jan 22 '19 at 23:04