2013-05-14 73 views
0

我讀使用此代碼Outlook郵件:如何使用EntryIDCollection訪問MS Outlook郵件?

Microsoft.Office.Interop.Outlook.Application myApp = new Microsoft.Office.Interop.Outlook.Application(); 
Microsoft.Office.Interop.Outlook.NameSpace mapiNameSpace = myApp.GetNamespace("MAPI"); 
Microsoft.Office.Interop.Outlook.MAPIFolder myInbox = mapiNameSpace.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox); 
int i = myInbox.Items.Count; 
string strSubject = ((Microsoft.Office.Interop.Outlook.MailItem)myInbox.Items[i]).Subject; 
string senderEmailid = ((Microsoft.Office.Interop.Outlook.MailItem)myInbox.Items[i]).SenderEmailAddress; 
string ToEmailid = ((Microsoft.Office.Interop.Outlook.MailItem)myInbox.Items[i]).To; 
string CcEmailid = ((Microsoft.Office.Interop.Outlook.MailItem)myInbox.Items[i]).CC; 
string BccEmailid = ((Microsoft.Office.Interop.Outlook.MailItem)myInbox.Items[i]).BCC; 
string CreationTime = ((Microsoft.Office.Interop.Outlook.MailItem)myInbox.Items[i]).CreationTime.ToString(); 

我越來越EntryIDCollection爲好。我如何使用EntryIDCollection而不是郵件數量,即i在我的代碼中讀取郵件?

我使用MS Outlook 2010中

回答

1

您可以使用Namespace.GetItemFromID

相關問題