问题
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
回答1:
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.
回答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.
回答3:
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.
来源:https://stackoverflow.com/questions/1158347/redemption-clickonce