Below code is attached with a button on my infopath form. It does work (
auto populates "To:" and "Subject" based on form nodes) but how can I attach
the file to the message which is attached to attachment control to the form?
Thanks
public void Email_Clicked(object sender, ClickedEventArgs e)
{
XPathNavigator docFM = this.CreateNavigator();
string attachName = docFM.SelectSingleNode("/my:myFields/my:txtSubject",
this.NamespaceManager).Value;
XPathNavigator docFT = this.CreateNavigator();
string msgTo = docFT.SelectSingleNode("/my:myFields/my:EmailTo",
this.NamespaceManager).Value;
Outlook.Application outlookApp = new Outlook.Application();
Outlook.MailItem message =
(Outlook.MailItem)outlookApp.CreateItem(Outlook.Ol ItemType.olMailItem);
message.Subject = attachName;
message.To = msgTo;
message.Body = "This is a test.";
message.Display(false);
outlookApp = null;
}}