Are you calling Marshall.ReleaseCOMObject or whatever that method is? Are
you maintaining any collections of objects or handles to objects that would
keep them alive? Are you releasing all objects by setting them to Nothing?

Signature
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
> Ken,
>
[quoted text clipped - 10 lines]
> Thanks,
> Markus
markus.kraemer@proacta.de - 23 Jul 2005 15:07 GMT
Just to avoid any side effects I but the code in a separate executable
and disable any COMAddIns for outlook.
The code just retrieve the calender-folder of an User an terminate.
The method DisposeObject.Singe use Marshal.ReleaseComObject(o) and set
the reference to null. As I can see so far, everythink in the code
should be allright.
Calling the GetSharedFolder() with User "User1" works fine, calling
the function with "User2" cause outlook to stay in memory.
I have still no idea, what's wrong.
Markus
=====================================================
private static void GetSharedFolder(string cUser)
{
Debug.WriteLine("GetSharedFolder");
try
{
Outlook.ApplicationClass oOutlook = new ApplicationClass();
Outlook.NameSpace oNS = oOutlook.GetNamespace("MAPI");
Recipient oRep=null;
MAPIFolder oFolder=null;
oRep = oNS.CreateRecipient(cUser);
if (oRep != null && oRep.Resolve())
{
oFolder = oNS.GetSharedDefaultFolder(oRep,
OlDefaultFolders.olFolderCalendar);
Debug.WriteLine(oRep.Name + " " + oFolder.Name);
}
DisposeObject.Single(oFolder);
DisposeObject.Single(oRep);
DisposeObject.Single(oNS);
DisposeObject.Single(oOutlook);
}
catch (SystemException e)
{
Debug.WriteLine(e.Message);
}
GC.Collect();
GC.WaitForPendingFinalizers();
}
public class DisposeObject
{
public static void Single(object o)
{
if (o != null)
{
int iRefCount = Marshal.ReleaseComObject(o);
o = null;
}
}
}
Ken Slovak - [MVP - Outlook] - 25 Jul 2005 15:05 GMT
And there are no errors anywhere when you try to get user2? You have the
same permissions on user2 as on user1? If so then I'm stumped.

Signature
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
> Just to avoid any side effects I but the code in a separate executable
> and disable any COMAddIns for outlook.
[quoted text clipped - 54 lines]
> }
> }
markus.kraemer@proacta.de - 27 Jul 2005 14:25 GMT
unfortunately there are no erros at all. Maybe there is something wrong
with permissions, but I have read/write access to the calendar of
"user2" via Outlook directly (and the same permission then "user1").
I have tested the code on a second machine where outlook 2003 is
installed. The code works fine for both users (the first test takes
place on a machine with outlook 2000 sp3).
Then I wrapped the code in a separate AppDomain (which should release
all RCW as shown in
http://msdn.microsoft.com/office/archive/default.aspx?pull=/library/en-us/odc_of
2003_bk/html/officeinteroperabilitych2_part2.asp
"AppDomain Unloading") -> also without any success on the outlook 2000
machine.
Finally I detele the mailbox of "user2" and create a new one.
Now the same code works also on the outlook 2000 machine.
So, maybe the problem is not due to the code but caused by a "corrupt"
mailbox.
Are there any exchange tools to "repair" a exchange-mailbox (or
perhaps any permission-problems)?
Ken, thanks for your tips so far
Markus
John Liu - 29 Jul 2005 04:17 GMT
If you are not aware, ScanPST is good for repairing PST and OST files.
It comes with your Outlook installation and you already have it.
Sue has a better write up here:
http://www.slipstick.com/problems/scanpst.htm
I don't know whether it would have fix your specific problem here
though.
jliu
johnliu.net