private void btnCheck_Click(object sender, EventArgs e) { try { Microsoft.Office.Interop.Outlook.Application myApp = new Microsoft.Office.Interop.Outlook.Application(); Microsoft.Office.Interop.Outlook.NameSpace mapiNameSpace = myApp.GetNamespace("MAPI"); mapiNameSpace.Logon("user2", "pass2", false, false); Microsoft.Office.Interop.Outlook.MAPIFolder myInbox = mapiNameSpace.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox); int a = myInbox.UnReadItemCount; txtInbox.Text = Convert.ToString(a); } catch (Exception err) { MessageBox.Show(err.ToString()); throw; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)