PC Review


Reply
Thread Tools Rate Thread

Add-in to Read from Public Folder

 
 
Chris McHenry
Guest
Posts: n/a
 
      28th Oct 2009
I have an C# VSTO add-in (running on both OL 2003 and OL 2007 clients) that is reading a large number of items from a public folder on startup. To improve performance, I moved this operation to a background thread. This seems to be working on a large set of my user population, but there is one user where it is causing Outlook to intermittently hang on startup. This user has OL2003 SP3. The Outlook client hangs when updating the folders and downloading data leading me to think that its something to do with cache mode.

I've read several posts that say not to use the OOM on a background thread. However, for my add-in to load in a reasonable amount of time I see few other alternatives for my architecture. I also saw some talk on this forum about marshalling data between the background and foreground threads, but the slowness I'm experiencing is reading the data using the OOM. Putting that on the foreground thread would frustrate my users to no end. One idea I had is to move this operation "out of process" by running another executable from my add-in or installing a service with my addin that does this work. I suppose this could create additional conflicts in the OOM?

I was using Outlook Redemption RDO objects to do this work, but found that due to the public folder architecture at my client, Redemption was not properly reading and authenticating to the public folder server for users who didn't have a public folder store on the same server as their mail store. I tried to troubleshoot with the Exchange admin, but found that nothing we did would make it work. Switching to the OOM worked, now I have this strange, one-off problem.

Here is the thread start block of code:

initThread = new Thread(CompleteInit);
initThread.Priority = ThreadPriority.Lowest;
initThread.IsBackground = true;
initThread.Start();

Here is the method called from CompleteInit where the code seems to hang:

public DataTable LoadDataTableFromConfig(string tableName)
{
ErrorLog.WriteLog(null, "ExchangeServer", "LoadDataTableFromConfig: Begin");
DataTable lDtResult = null;
try
{
ErrorLog.WriteLog(null, "ExchangeServer", "LoadDataTableFromConfig: Loading Public Folder: " + tableName);

if (tableName == "tblFileplanConfig")
return GetFilePlan();

lDtResult = SelectDatastructure(tableName);

OOMFolder folder = GetPublicFolder(@"ControlCenter\" + tableName);
if (folder != null)
{
ErrorLog.WriteLog(null, "ExchangeServer",
"LoadDataTableFromConfig: Found Public Folder - " + folder.FullFolderPath);

Items mailItems = folder.Items;
foreach (MailItem item in mailItems)
{
ErrorLog.WriteLog(null, "ExchangeServer", "GetFilePlan(): bailOut: " + bailOut);
if (bailOut)
return null;

ErrorLog.WriteLog(null, "ExchangeServer", "LoadDataTableFromConfig: Reading item");
if (item != null)
{
//string comment = (string)GetPropertyHelper(item, "comment");
SafeMailItem safeMailItem = new SafeMailItem();
safeMailItem.Item = item;
const int prComment = 0x3004001E;
string comment = (string)safeMailItem.get_Fields(prComment);
ErrorLog.WriteLog(null, "ExchangeServer", "LoadDataTableFromConfig - Found item:" + comment);
string[] dataElements = comment.Split(new char[] { '|' });

DataRow dr = lDtResult.NewRow();
for (int i = 0; i < lDtResult.Columns.Count; i++)
{
try
{
dr[i] = GetValueFromArray(dataElements, lDtResult.Columns[i].ColumnName);
}
catch (Exception ex)
{
ErrorLog.WriteLog(ex, "ExchangeServer", "GetProperties:");
}
}
lDtResult.Rows.Add(dr);

}
}

}
}
catch (Exception ex)
{
ErrorLog.WriteLog(ex, "ExchangeServer", "LoadDataTableFromConfig:");
throw;
}

ErrorLog.WriteLog(null, "ExchangeServer", "LoadDataTableFromConfig: Complete");
return lDtResult;
}



Does anyone have any ideas for me as to how to work around this limitation of Outlook?

EggHeadCafe - Software Developer Portal of Choice
FLASH: Fix for Windows Vista
http://www.eggheadcafe.com/tutorials...indows-vi.aspx
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
public folder contact read only wilecoyote Microsoft Outlook Discussion 0 17th Jan 2007 05:31 PM
public folder contact read only wilecoyote Microsoft Outlook 0 17th Jan 2007 05:30 PM
Public Folder with contacts - some read only some not =?Utf-8?B?VmlrZXNo?= Microsoft Outlook Discussion 0 17th Jul 2006 04:09 PM
Read content of a public folder using C# Anders K. Olsen Microsoft C# .NET 2 8th Sep 2005 08:32 AM
A read receipt in a Public Folder =?Utf-8?B?QU1lc3N5R3V5?= Microsoft Outlook Discussion 0 20th May 2005 10:23 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:19 PM.