<?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>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: MailEnvelope error</title><link>https://www.infopathdev.com:443/forums/thread/15185.aspx</link><pubDate>Sun, 18 Mar 2007 17:25:09 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:15185</guid><dc:creator>cvinfo1</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/15185.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=15185</wfw:commentRss><description>Can anyone help me here please?&lt;br /&gt;&lt;br /&gt;This the code I have after the recommendation by nukkumatti, below. I get the same error "InfoPath has encountered an error. The operation failed.The form's code contains an error. The following call in the form's code failed: MailEnvelope.To&lt;br /&gt;File:script.js&lt;br /&gt;Line:44"&lt;br /&gt;&lt;br /&gt;Code...&lt;br /&gt;{&lt;br /&gt;	var oEnvelope = Application.ActiveWindow.MailEnvelope;&lt;br /&gt;	oEnvelope.To = XDocument.DOM.selectSingleNode("my:ConfirmFilesForm/my:GroupEmail").text + ";" +&lt;br /&gt;		XDocument.DOM.selectSingleNode("my:ConfirmFilesForm/my:GroupEmail2").text;&lt;br /&gt;	oEnvelope.Subject = "PHS EDI File Confirmation - " + &lt;br /&gt;		XDocument.DOM.selectSingleNode("my:ConfirmFilesForm/my:GroupName").text;&lt;br /&gt;	oEnvelope.Visible = true;&lt;br /&gt;}</description></item><item><title>Re: MailEnvelope error</title><link>https://www.infopathdev.com:443/forums/thread/15184.aspx</link><pubDate>Fri, 16 Mar 2007 14:06:37 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:15184</guid><dc:creator>cvinfo1</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/15184.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=15184</wfw:commentRss><description>Thank you nukkumatti. So this may be a dumb question but like I said I don't know much about this. Would I need to change all references to XDocument.View to Application.ActiveWindow...? The reason I ask is I made that change and then it prompted the error on the next line (oEnvelope.To...), see below.&lt;br /&gt;&lt;br /&gt;The following error occurred:&lt;br /&gt;&lt;br /&gt;InfoPath has encountered an error. The operation failed.&lt;br /&gt;The form's code contains an error. &lt;br /&gt;&lt;br /&gt;The following call in the form's code failed: MailEnvelope.To&lt;br /&gt;File:script.js&lt;br /&gt;Line:47&lt;br /&gt;&lt;br /&gt;function CTRL37_5::OnClick(eventObj) { // Write your code here try Application.ActiveWindow.MailEnvelope; //instead of your XDocument.View....... &lt;br /&gt;//var oEnvelope = XDocument.View.Window.MailEnvelope; &lt;br /&gt;var oEnvelope = Application.ActiveWindow.MailEnvelope; &lt;br /&gt;oEnvelope.To = XDocument.DOM.selectSingleNode("my:ConfirmFilesForm/my:GroupEmail").text + ";" + XDocument.DOM.selectSingleNode("my:ConfirmFilesForm/my:GroupEmail2").text; &lt;br /&gt;oEnvelope.Subject = "PHS EDI File Confirmation - " + XDocument.DOM.selectSingleNode("my:ConfirmFilesForm/my:GroupName").text; oEnvelope.Visible = true; }&lt;br /&gt;&lt;br /&gt;Thanks!</description></item><item><title>Re: MailEnvelope error</title><link>https://www.infopathdev.com:443/forums/thread/15183.aspx</link><pubDate>Thu, 15 Mar 2007 14:21:53 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:15183</guid><dc:creator>nukkumatti</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/15183.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=15183</wfw:commentRss><description>try Application.ActiveWindow.MailEnvelope;&lt;br /&gt;instead of your XDocument.View.......</description></item><item><title>MailEnvelope error</title><link>https://www.infopathdev.com:443/forums/thread/13087.aspx</link><pubDate>Thu, 15 Mar 2007 13:59:50 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13087</guid><dc:creator>cvinfo1</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13087.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13087</wfw:commentRss><description>Hello,&lt;br /&gt;&lt;br /&gt;I don't know enough about scripting to resolve this so please help. When I click on my Create Email button. I get this error:&lt;br /&gt;The following error occurred:&lt;br /&gt;&lt;br /&gt;InfoPath has encountered an error. The operation failed.&lt;br /&gt;The form's code contains an error. &lt;br /&gt;&lt;br /&gt;The following call in the form's code failed: MailEnvelope.To&lt;br /&gt;File:script.js&lt;br /&gt;Line:44&lt;br /&gt;&lt;br /&gt;This is the code I have for this:&lt;br /&gt;function CTRL37_5::OnClick(eventObj)&lt;br /&gt;{&lt;br /&gt;	// Write your code here&lt;br /&gt;	var oEnvelope = XDocument.View.Window.MailEnvelope;&lt;br /&gt;	oEnvelope.To = XDocument.DOM.selectSingleNode("my:ConfirmFilesForm/my:GroupEmail").text + ";" +&lt;br /&gt;		XDocument.DOM.selectSingleNode("my:ConfirmFilesForm/my:GroupEmail2").text;&lt;br /&gt;	oEnvelope.Subject = "PHS EDI File Confirmation - " + &lt;br /&gt;		XDocument.DOM.selectSingleNode("my:ConfirmFilesForm/my:GroupName").text;&lt;br /&gt;	oEnvelope.Visible = true;&lt;br /&gt;}&lt;br /&gt;Is the code wrong?&lt;br /&gt;&lt;br /&gt;Any help would be greatly appreciated.&lt;br /&gt;&lt;br /&gt;Thanks!!</description></item></channel></rss>