Creating a Background Worker Thread

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

Creating a Background Worker Thread
Jim Albert

Posts: 21
Joined: 2005-12-31
I am using version 2.8 of the Add-in-express to create an Outlook COM addin. I have some processing that I would like to do in the background. The problem that I am having is that if I create a thread to do the processing, outlook will no longer shutdown.

Here is basically what I have tried to do...

private void AddinModule_AddinStartupComplete(object sender, System.EventArgs e) {
System.Threading.Thread t = new System.Threading.Thread(
new System.Threading.ThreadStart(InitThreadFunction));
t.Name = "Init Thread";

public void InitThreadFunction() {
bool offline = HostApplication.Session.Offline;

As soon as I add the access to the Session object, Outlook will no longer shutdown. I have tried to add calls to the ReleaseComObject, but it does not seem to help.

Posted 26 Feb, 2007 15:45:56 Top
Sergey Grischenko

Add-in Express team

Posts: 7235
Joined: 2004-07-05
Hi Jim.

To solve the issue you need to store the session object in a local variable of the addinmodule.

private Outlook.Namespace sessionObj;

private void AddinModule_AddinInitialize(object sender, EventArgs e)
sessionObj = HostApplication.Session;

P.S. Note that we take up your forum requests in the order we receive them.
Besides, it may take us some time to investigate your issue. Please be sure we will let you know as soon as the best possible solution is found.
Posted 27 Feb, 2007 07:48:28 Top