Exception when trying to save a contact.

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
 
K

Ken Slovak

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.
 
D

Dave Townsend

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
 
K

Ken Slovak

Remote Procedure Call. Used when you access an object from Outlook using
..NET through the COM interop.
 
D

Dave Townsend

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
 
K

Ken Slovak

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top