Redemption + Clickonce = :-(

前端 未结 3 569
生来不讨喜
生来不讨喜 2021-01-16 11:05

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 (fr

相关标签:
3条回答
  • 2021-01-16 11:42

    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.

    0 讨论(0)
  • 2021-01-16 11:46

    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.

    0 讨论(0)
  • 2021-01-16 11:55

    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.

    0 讨论(0)
提交回复
热议问题