Looks like I need message.Attachments.Add (sSource, object Type, object
Position, object DisplayName)
If I do:
String sSource = @"C:\abc.txt", it gets attached to the message.
How can I set "sSource" value bases on "attachName" form field?
String sSource = @"C:\ + attachName + .txt" ???
"andyoye" <andyoye@nospam.comwrote in message
news:OzJUv1L7IHA.3816@TK2MSFTNGP03.phx.gbl...
Quote:
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;
>
}}
>
>