<?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: Problem with Form Version Upgrade code C#</title><link>https://www.infopathdev.com:443/forums/thread/79128.aspx</link><pubDate>Thu, 31 May 2012 20:53:00 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:79128</guid><dc:creator>boreal</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/79128.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=79128</wfw:commentRss><description>&lt;p&gt;Thanks again, Jimmy. I will take a different approach that means more grunt work and less coding. &amp;lt;lame, i know&amp;gt;&lt;/p&gt;&lt;p&gt;I will create a new field and write a FormEvents_Loading function that will copy the contents of my old fields to my new field. Open/save each form in turn to concatenate the old data and paste it into the new field. Then, I will remove the old fields and re-design the form, as required.&lt;/p&gt;&lt;p&gt;Yup, these docs are being saved in SharePoint.&lt;/p&gt;</description></item><item><title>Re: Problem with Form Version Upgrade code C#</title><link>https://www.infopathdev.com:443/forums/thread/78973.aspx</link><pubDate>Sat, 26 May 2012 15:37:33 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:78973</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/78973.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=78973</wfw:commentRss><description>&lt;p&gt;If you use the custom upgrade with code option, that means the burden is on you to write code to determine what needs to be upgraded and make the modifications therein.&amp;nbsp; The automatic upgrade functionality gets turned off.&amp;nbsp; That&amp;#39;s a pretty big hassle and a reason why it&amp;#39;s usually not a good idea to do the upgrade in code or change the main data source in such a way that would break the automatic upgrade.&amp;nbsp; How drastically did you change it?&lt;/p&gt;&lt;p&gt;What are you using to store your documents?&amp;nbsp; SharePoint?&lt;/p&gt;</description></item><item><title>Re: Problem with Form Version Upgrade code C#</title><link>https://www.infopathdev.com:443/forums/thread/78971.aspx</link><pubDate>Fri, 25 May 2012 21:30:43 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:78971</guid><dc:creator>boreal</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/78971.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=78971</wfw:commentRss><description>&lt;p&gt;Thanks for the quick response, Jimmy.&lt;/p&gt;&lt;p&gt;Ah, my:AllReq is the new field and the form&amp;#39;s schema update hasn&amp;#39;t happened yet when VersionUpgrade is called, right? So that node is not found. &lt;/p&gt;&lt;p&gt;Hmm, where should I copy the legacy node data to then?&lt;/p&gt;&lt;p&gt;Am I way off base here? Sorry for my noobness.&lt;/p&gt;</description></item><item><title>Re: Problem with Form Version Upgrade code C#</title><link>https://www.infopathdev.com:443/forums/thread/78946.aspx</link><pubDate>Fri, 25 May 2012 06:32:19 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:78946</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/78946.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=78946</wfw:commentRss><description>&lt;p&gt;A NullReferenceException here will almost always mean that the node you are trying to select was not found.&amp;nbsp; Is my:AllReq a field from before or from after the modifications?&lt;/p&gt;&lt;p&gt;&amp;nbsp;We have tentatively&amp;nbsp;looked into adding custom version upgrade feature to qRules, but unfortunately haven&amp;#39;t come up with a good way to do it so far.&lt;/p&gt;</description></item><item><title>Problem with Form Version Upgrade code C#</title><link>https://www.infopathdev.com:443/forums/thread/78918.aspx</link><pubDate>Thu, 24 May 2012 17:15:27 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:78918</guid><dc:creator>boreal</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/78918.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=78918</wfw:commentRss><description>&lt;p&gt;I&amp;#39;m working to upgrade a browser based InfoPath 2010 form in a SharePoint library with tonnes of filled out copies of the form. &lt;/p&gt;&lt;p&gt;The form design needs to change rather drastically and I need to handle the case where an old version of the form opens, is upgraded, and legacy data is lost due to changes in the schema from the upgrade.&lt;/p&gt;&lt;p&gt;I have done a fair bit of research and think that the best option would be to use the FormEvents_VersionUpgrade function to copy values from legacy nodes to new nodes on version upgrade (to avoid data loss). However, I quickly ran into a problem with my code just trying to do a test SetValue to one of my new nodes (AllReq). &lt;/p&gt;&lt;p&gt;Receiving an error 5337 &amp;quot;Object reference not set to an instance of an object&amp;quot;.&lt;/p&gt;&lt;p&gt;Here&amp;#39;s my code:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void FormEvents_VersionUpgrade(object sender, VersionUpgradeEventArgs e)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XPathNavigator xMain = MainDataSource.CreateNavigator();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XPathNavigator AllReqPath;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AllReqPath = xMain.SelectSingleNode(&amp;quot;//my:AllReq&amp;quot;, NamespaceManager);&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (AllReqPath.Value == null)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AllReqPath.SetValue(&amp;quot;xxxxxxxx&amp;quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;&lt;p&gt;Any assistance would be greatly appreciated!&lt;/p&gt;&lt;p&gt;ps is there a way to handle version upgrade with Qrules?&lt;/p&gt;&lt;p&gt;&amp;nbsp;Phil&lt;/p&gt;</description></item></channel></rss>