BerndH
Posts: 99
Joined: 2014-09-23
|
Hi,
don?t know if it?s an ad-in-express-problem, but:
I wrote an add-in for outlook. Works well, but on ONE system. Outlook crashes while starting.
My log shows me, it?s while I add a function to the outlook folders.
I have a foreach-loop checking every folder from outlook (recursively) if it?s the "one", then I add a special event.
In my startup-method I do like this:
...
var ns = OutlookApp.GetNamespace("MAPI");
foreach (Outlook.MAPIFolder therootfolder in ns.Folders)
{
AddFolderHandlers(therootfolder, checkfoldername);
}
...
And in the AddFolderHandlers I do something like this:
...
foreach (Outlook.MAPIFolder folder in therootfolder.Folders)
{
// not my special folder
if (!folder.FolderPath.ToLower().Equals(checkfoldername)) continue;
// yes, my folder, add the function
_outlookFolderWithAddInEvent.Add(folder.Items);
_outlookFolderWithAddInEvent.Last().ItemAdd += item =>
{
var result = TheNewMailitemEvent(item); // my new event for this mail item
};
// recursive next try with act folder for getting the subfolders
AddFolderHandlers(folder, checkfoldername);
}
Only on one system I get sometimes an exception like this: "Can?t establish connection with Microsoft Exchange".
Can you give me a hint, what?s my problem here?
Sometimes Outlook just crashes.
Bernd |
|
Dmitry Kostochko
Add-in Express team
Posts: 2875
Joined: 2004-04-05
|
|
BerndH
Posts: 99
Joined: 2014-09-23
|
So I did some tests. The client has 4120 folders in its outlook. And the exchange server has as a maximum of 32 MoMT objects per session.
I try to do a workaround not "downloading" all folders for get the ones where I want to install my own special event .... |
|
Dmitry Kostochko
Add-in Express team
Posts: 2875
Joined: 2004-04-05
|
Hi Bernd,
Thank you for keeping us informed.
Nevertheless, I would recommend that you release COM objects in your code. |
|