0
votes

I'm trying to access to some Shared Mailboxes(the "Open these additional mailboxes" listing) but I bumped into a kind of "access denied". Make my point clear... I wrote this code:

IList<Store> lsStores = Application.Session.Stores.Cast<Store>().Where(c => c.ExchangeStoreType == OlExchangeStoreType.olExchangeMailbox).ToList();

But I have this error(in the Log folder):

System.Runtime.InteropServices.COMException (0xAD54011D): Exception from HRESULT: 0xAD54011D at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) at System.Runtime.InteropServices.CustomMarshalers.EnumeratorViewOfEnumVariant.MoveNext() at System.Linq.Enumerable.d__951.MoveNext() at System.Linq.Enumerable.WhereEnumerableIterator1.MoveNext() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) at Detatchatore.Detachatore.btnAvvia_Click(Object sender, EventArgs e) in C:\Users\Me\Project\Form1.cs:line 52

In my personal computer this error doesn't show, neither my coworkers have this problem. But when I install the Application into operator pc (Application must work in his pc), I have this exception. Thanks, and sorry for my poor English.

1

1 Answers

0
votes

First of all, I'd recommend avoiding any LINQ queries with Outlook objects. Moreover, I'd suggest releasing them in a timely manner, i.e. as soon as possible. You may find the following links helpful:

Second, you need to break the chain of property or method calls and declare each property or method on a separate line of code. Thus, you will be able to find the problematic one if the code fails.