<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Data Connections</title><link>https://www.infopathdev.com:443/forums/44.aspx</link><description> </description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Set attachment name and display in the message body</title><link>https://www.infopathdev.com:443/forums/thread/44181.aspx</link><pubDate>Sun, 12 Jul 2009 17:59:57 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:44181</guid><dc:creator>bcmps</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/44181.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=44181</wfw:commentRss><description>&lt;p&gt;Hello,&lt;br /&gt;&lt;br /&gt;I&amp;#39;m using Infopath 2003 to design a form that will be submitted to a SharePoint after filled out. The Data Connection sets the name of the form, based on the name of two fields. &lt;br /&gt;I need the user to have the option of sending an email with the form attached and appearing in the body of the message. To do this, I tried the code:&lt;br /&gt;var objEmail = XDocument.DataAdapters(&amp;quot;SubmitEmail&amp;quot;);&lt;br /&gt;objEmail.Submit();&lt;br /&gt;Using this, the attachment received the correct name was not displayed in the message body.&lt;br /&gt;Then I tried:&lt;br /&gt;objEmail = Application.ActiveWindow.MailEnvelope;&lt;br /&gt;Using this, the attachment was displayed in the body of the message, but the attachment name was not set (stayed on Form1.xml).&lt;br /&gt;&lt;br /&gt;The only way I’ve found to work around was to create user roles to a New and a Submitted form. The Email button is displayed only in the submitted role that I set as default.&lt;br /&gt;So, the user has to submit the form and reopen it via SharePoint. This way, the form name will be ok and I can have the correct attachment name to use with MailEnvelope.&lt;br /&gt;&lt;br /&gt;Is there a simple way to do this?&lt;br /&gt;How could I set the form name after submitting it?&lt;/p&gt;&lt;p&gt;Thanks &lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>