Mohit
Mohit

Reputation: 922

CPU usage reachs 100% while inserting contacts in Outlook using C#?

This question is related to my question regarding inserting contacts to Outlook.

Nobody was able to suggest any way of doing this beside beside OOM (Outlook Object Model) or Microsoft Outlook object library 12.0, so I ended up using OOM.

When I try to insert 1000 records my CPU usage goes to 100%. I am closing the contact, do I have to dispose of or close anything else?

Also, if my program is running and Outlook is open, if somebody closes Outlook then the program errors out.

Upvotes: 1

Views: 165

Answers (1)

Mohit
Mohit

Reputation: 922

I was able to solve this by using following 2 lines. Dont know how, but it got solved

GC.WaitForPendingFinalizers(); GC.Collect();

Regards

Mohit Thakral

Upvotes: 1

Related Questions