<?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: Problems using SharePoint objects in loading event</title><link>https://www.infopathdev.com:443/forums/thread/65108.aspx</link><pubDate>Fri, 11 Mar 2011 19:23:29 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:65108</guid><dc:creator>ferrx</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/65108.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=65108</wfw:commentRss><description>&lt;p&gt;I looks like I just needed to set the trust level to Full Trust to get it to execute SP code.&lt;/p&gt;</description></item><item><title>Problems using SharePoint objects in loading event</title><link>https://www.infopathdev.com:443/forums/thread/65098.aspx</link><pubDate>Fri, 11 Mar 2011 15:17:22 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:65098</guid><dc:creator>ferrx</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/65098.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=65098</wfw:commentRss><description>&lt;p&gt;I am getting the &amp;quot;form has closed&amp;quot; error whenever I add any SharePoint&amp;nbsp;code at all to my LoadingEventHandler for my InfoPath form.&amp;nbsp; I have been able to do non-SP stuff such as modify the value of a field, but as soon as I add in code like:&lt;/p&gt;
&lt;p&gt;SPSite site = SPContext.Current.Site;&lt;/p&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;p&gt;using(SPSite siteCollection = new SPSite(&amp;quot;...url&amp;quot;))&lt;br /&gt;{&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;Once code like that is added,&amp;nbsp;I get that &amp;quot;form has closed&amp;quot; error upon opening the form.&amp;nbsp; Am I missing something, a dll reference or something?&amp;nbsp; Should this work?&lt;/p&gt;</description></item></channel></rss>