Discussion:
Access MailItem Values
(too old to reply)
Madhooooo
2007-08-24 15:04:01 UTC
Permalink
I have a customized oft (mail item), It has "To", "Cc" and "Subject" Text
fields. Whenever i try to access the values in

these controls it always accesses the last entered value.

fr ex: If after the oft loaded, I try to access the value in "To" text field
using "m_mailItem.To" on click of Send/ Save as or any button like that it
gives null value.

Next after the form has loaded if I fill in some value like "text" it still
gives null

Next, after the form has reloaded, if I fill in another value like "text1"
it gives "text" and not "text1" while it shld have

given "text1".

here is the code Im using,



Outlook.Inspector m_Inspector = m_Application.ActiveInspector();

if (m_Inspector.CurrentItem is Outlook.MailItem)

{

Outlook.MailItem m_MailItem1 = (Outlook.MailItem)m_Inspector.CurrentItem;

string strToAddresses1 = m_MailItem1.To;


}



I dont understand wht the prob cud be.....Please help me :-((
Jan Hyde (VB MVP)
2007-08-24 15:35:55 UTC
Permalink
Madhooooo <***@discussions.microsoft.com>'s wild
thoughts were released on Fri, 24 Aug 2007 08:04:01 -0700
Post by Madhooooo
I have a customized oft (mail item), It has "To", "Cc" and "Subject" Text
fields. Whenever i try to access the values in
these controls it always accesses the last entered value.
fr ex: If after the oft loaded, I try to access the value in "To" text field
using "m_mailItem.To" on click of Send/ Save as or any button like that it
gives null value.
Next after the form has loaded if I fill in some value like "text" it still
gives null
Next, after the form has reloaded, if I fill in another value like "text1"
it gives "text" and not "text1" while it shld have
given "text1".
here is the code Im using,
Outlook.Inspector m_Inspector = m_Application.ActiveInspector();
if (m_Inspector.CurrentItem is Outlook.MailItem)
{
Outlook.MailItem m_MailItem1 = (Outlook.MailItem)m_Inspector.CurrentItem;
string strToAddresses1 = m_MailItem1.To;
}
I dont understand wht the prob cud be.....Please help me :-((
Either ask in a C group or post in VB please.


--
Jan Hyde

https://mvp.support.microsoft.com/profile/Jan.Hyde

Loading...