Click here to Skip to main content
15,915,093 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Shared Data Problem Pin
Rick York4-May-04 6:27
mveRick York4-May-04 6:27 
GeneralRe: Shared Data Problem Pin
sweep1234-May-04 6:36
sweep1234-May-04 6:36 
GeneralRe: Shared Data Problem Pin
Rick York4-May-04 11:02
mveRick York4-May-04 11:02 
GeneralRe: Shared Data Problem Pin
sweep1235-May-04 3:41
sweep1235-May-04 3:41 
Generalvisual studio Pin
Mr. Cully4-May-04 5:25
Mr. Cully4-May-04 5:25 
GeneralRe: visual studio Pin
jmkhael4-May-04 5:27
jmkhael4-May-04 5:27 
GeneralRe: visual studio Pin
Mr. Cully4-May-04 5:43
Mr. Cully4-May-04 5:43 
Generalgetting the email address from an outlook _MailItem Pin
BlackDice4-May-04 5:10
BlackDice4-May-04 5:10 
I have the following code that reads all the messages currently in the user's inbox and inserts them into a listview. I'm using automation and everything seems to be working fine except for getting the sender's email address. There's a property for getting the sender's name, but not the email address. here's the code I have so far. Hope anyone can help!! Thanks!!

void COtestDlg::OnRun() 
{

	MapiMessage mm;
	MAPIFolder				folderInbox;
	_NameSpace				ns;
	_Items						itemsMessages;
	_MailItem					mi;
	_Application			app;  // app is the Outlook 2000 application object
	
	
	
	// Start Outlook and get Application object...
	if(!app.CreateDispatch("Outlook.Application"))
	{
		AfxMessageBox("Couldn't start Outlook.");
	}
	else
	{
		ns = app.GetNamespace("MAPI");

		COleVariant vt;
		COleVariant vtOptional("");
		COleVariant vtTrue;
		vt.ChangeType(VT_BOOL);
		vt.boolVal = true;
		vt.ChangeType(VT_I2,NULL);

		ns.Logon(vtOptional, vtOptional, vtTrue, vtTrue);
		folderInbox = ns.GetDefaultFolder(6);
		itemsMessages = folderInbox.GetItems();
		
		for (int x = 0; x < itemsMessages.GetCount(); x++)
		{
			
			mi = itemsMessages.Item(COleVariant((long) x + 1L));
			m_lvwResults.InsertItem(x,mi.GetSenderName());
			m_lvwResults.SetItemText(x,1,mi.GetSubject());
			m_lvwResults.SetItemText(x,2,mi.GetBody());
		}

		ns.Logoff();
		
	}	
}


If it's broken, I probably did it

bdiamond
GeneralRe: getting the email address from an outlook _MailItem Pin
Michael P Butler4-May-04 5:42
Michael P Butler4-May-04 5:42 
GeneralRe: getting the email address from an outlook _MailItem Pin
BlackDice4-May-04 6:29
BlackDice4-May-04 6:29 
Generaljpg to bmp Pin
Qualvis4-May-04 5:10
Qualvis4-May-04 5:10 
GeneralRe: jpg to bmp Pin
jmkhael4-May-04 5:13
jmkhael4-May-04 5:13 
Questionis there a way to run programs with other programs? Pin
jetournier4-May-04 4:59
jetournier4-May-04 4:59 
AnswerRe: is there a way to run programs with other programs? Pin
jmkhael4-May-04 5:01
jmkhael4-May-04 5:01 
GeneralRe: is there a way to run programs with other programs? Pin
jetournier5-May-04 2:37
jetournier5-May-04 2:37 
GeneralRe: is there a way to run programs with other programs? Pin
jmkhael5-May-04 2:41
jmkhael5-May-04 2:41 
Generalcapturing message from app2 Pin
pnpfriend4-May-04 4:57
pnpfriend4-May-04 4:57 
GeneralRe: capturing message from app2 Pin
Anonymous5-May-04 3:49
Anonymous5-May-04 3:49 
GeneralThank You CodeProject Pin
gUrM33T4-May-04 4:44
gUrM33T4-May-04 4:44 
GeneralRe: Thank You CodeProject Pin
jmkhael4-May-04 4:51
jmkhael4-May-04 4:51 
GeneralAckermann Function Pin
pmasknguyen4-May-04 4:24
pmasknguyen4-May-04 4:24 
GeneralRe: Ackermann Function Pin
Jens Doose4-May-04 4:36
Jens Doose4-May-04 4:36 
GeneralFinding Mem Usage of another program Pin
tjkrz4-May-04 4:16
tjkrz4-May-04 4:16 
GeneralRe: Finding Mem Usage of another program Pin
Joe Woodbury4-May-04 4:23
professionalJoe Woodbury4-May-04 4:23 
GeneralRe: Finding Mem Usage of another program Pin
Dudi Avramov4-May-04 5:08
Dudi Avramov4-May-04 5:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.