M
markm75
I have this windows form app.. where i have a text box and from outlook i
want to be able to drag and drop from outlook to the form and basically copy
to this text box the subject and body text...
I thought i almost had this figured out.. here is the code near the end that
tries to "find" the outlook (2007) window and find the mail item data:
Microsoft.Office.Interop.Outlook.Application outlook;
//outlook = (Microsoft.VisualBasic.Interaction.GetObject("",
"Outlook.Application")) as Microsoft.Office.Interop.Outlook.Application;
try
{
//try to create comm component with vb interaction
outlook =
(Microsoft.Office.Interop.Outlook.Application)Microsoft.VisualBasic.Interaction.GetObject("", "Outlook.Application");
}
catch (System.Exception ex)
{
throw new ApplicationException("error" + ex);
}
//get the active one
Microsoft.Office.Interop.Outlook.Explorer explorer =
outlook.ActiveExplorer();
Microsoft.Office.Interop.Outlook.MailItem mail =
(Microsoft.Office.Interop.Outlook.MailItem)explorer.Selection[0];
//if (mail.Subject = maildata("Betreff").ToString())
//{
return mail;
It gets stuck on the line
outlook =
(Microsoft.Office.Interop.Outlook.Application)Microsoft.VisualBasic.Interaction.GetObject("", "Outlook.Application");
It will either sit there forever or if i actually put a break on the catch,
i am shown "cannot create activex component" as an error...
I'm not sure how else to go about this.. any thoughts?
Thanks
want to be able to drag and drop from outlook to the form and basically copy
to this text box the subject and body text...
I thought i almost had this figured out.. here is the code near the end that
tries to "find" the outlook (2007) window and find the mail item data:
Microsoft.Office.Interop.Outlook.Application outlook;
//outlook = (Microsoft.VisualBasic.Interaction.GetObject("",
"Outlook.Application")) as Microsoft.Office.Interop.Outlook.Application;
try
{
//try to create comm component with vb interaction
outlook =
(Microsoft.Office.Interop.Outlook.Application)Microsoft.VisualBasic.Interaction.GetObject("", "Outlook.Application");
}
catch (System.Exception ex)
{
throw new ApplicationException("error" + ex);
}
//get the active one
Microsoft.Office.Interop.Outlook.Explorer explorer =
outlook.ActiveExplorer();
Microsoft.Office.Interop.Outlook.MailItem mail =
(Microsoft.Office.Interop.Outlook.MailItem)explorer.Selection[0];
//if (mail.Subject = maildata("Betreff").ToString())
//{
return mail;
It gets stuck on the line
outlook =
(Microsoft.Office.Interop.Outlook.Application)Microsoft.VisualBasic.Interaction.GetObject("", "Outlook.Application");
It will either sit there forever or if i actually put a break on the catch,
i am shown "cannot create activex component" as an error...
I'm not sure how else to go about this.. any thoughts?
Thanks