Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook mail checker freezing up

Status
Not open for further replies.

djam

Technical User
Nov 15, 2002
223
CA
I have a program that constantly checks a specific folder in Outlook. The check occurs every 2 seconds. The program sometimes freezes up after Line 6 and before Line 9. If I go to the console screen and hit the Enter key the program will continue on. The problem might be because I'm constantly checking the Outlook folder. Is there something else that I can do instead of constantly checking? Or can I fix my code? But I don't see anything really wrong with it.

1. while (true)
2. {
3. Outlook.MAPIFolder oFolder = (Outlook.MAPIFolder)(oNS.Folders.Item(2);
4. Console.WriteLine (oFolder.Name.ToString()+" has this many mail "+oFolder.Items.Count);
5. int numMail = oFolder.Items.Count;
6. Console.writeln (numMail);
7. if (numMail > 0)
8. {
9. <do something>
10. }
11. Thread.Sleep(2000);
12. }

&quot; ahhh computers, how they made our lives much simpler ;) &quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top