#import "C:\Program Files (x86)\Common Files\microsoft shared\OFFICE14\mso.dll" no_namespace,rename("DocumentProperties", "DocProps") #import "C:\Program Files (x86)\Microsoft Office\Office14\MSOUTL.OLB" \ rename_namespace("Outlook") \ rename("GetOrganizer", "GetOrganizerAddressEntry") #pragma warning(default:4146) using namespace Outlook; int main() { CoInitialize(NULL); _ApplicationPtr spApp("Outlook.Application"); _NameSpacePtr pMAPI = spApp->GetNamespace("MAPI"); pMAPI->Logon("","",false,false); MAPIFolderPtr InboxFolder = pMAPI->GetDefaultFolder(olFolderInbox); _ItemsPtr Items = InboxFolder->GetItems(); printf("Total number of messages in Inbox - %d \n", Items->Count); CoUninitialize(); return 0; }
转载于:https://www.cnblogs.com/marryZhan/archive/2011/11/25/2268281.html