Exception when trying to save a contact.

  • Thread starter Thread starter Dave Townsend
  • Start date Start date
D

Dave Townsend

I am coming across a strange error when trying to save a ContactItem.
Basically I am reading a large number of names and phone numbers from a
text file and storing each one as a contact. I have created the folder
ok and it does create new contacts happily until it is around half way
through the list. Then it fails, and it fails on a different contact
each time.

I'm writing in C# and the only thing I have found so far is that if I
put a try...catch block around the call to the Save method then it lets
me see the exception. The exception text is: "HRESULT 0xBFE7000E".
Unfortunately this means little to me, anyone out there understand what
could cause that error?

Dave
 
Are you ending up opening up more than 255 RPC channels in your code. Be
aware that due to the nature of how .NET code releases objects with the
garbage collector that objects may linger on and not be fully released until
an indeterminate time in the future and those RPC channels aren't released
until the objects are released. You might have to call a procedure to
explicitly release your objects in your loop to avoid that RPC channel
limit.
 
Ok, not sure what RPC means, but I'm reading it as an open COM object in
which case yes that is a possibility, I'll give that a try.

Thanks

Dave
 
Remote Procedure Call. Used when you access an object from Outlook using
..NET through the COM interop.
 
Ken said:
Remote Procedure Call. Used when you access an object from Outlook using
..NET through the COM interop.

Just wondering, not a problem in my situation, but what if for some
reason someone wanted to have access to more than 255 COM objects at a
time, is that impossible?

Dave
 
You would have to close some existing channels, which requires releasing the
objects using those channels. Just one of the many limitations of using .NET
coding with Outlook.
 
Back
Top