<?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>InfoPath 2013 Code Behind and Data Connections work with Sandbox?</title><link>https://www.infopathdev.com:443/forums/thread/97069.aspx</link><pubDate>Sat, 19 Apr 2014 19:24:34 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:97069</guid><dc:creator>harp71</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/97069.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=97069</wfw:commentRss><description>&lt;p&gt;Can&amp;#39;t find a clear answer out there so thought I&amp;#39;d ping the group...&amp;nbsp; I&amp;#39;ve simplified the scenario as far as I can for this one...&lt;/p&gt;&lt;p&gt;Scenario:&lt;/p&gt;&lt;p&gt;InfoPath 2013 Forms Services.&amp;nbsp; Publishing directly to Form Library.&amp;nbsp; Works fine if either Data connections exist, or simple custom code exists (i.e. on form load set the value of a textbox on the form to &amp;quot;Hello From Code Behind&amp;quot;.&lt;/p&gt;&lt;p&gt;HOWEVER, if you put a Data connection (ListService from same site retrieve values from a SPList and display them in a drop down box on the form) on the same form as simple code behind and publish, you get an error on form load:&lt;/p&gt;&lt;p&gt;&amp;quot;Warning.&amp;nbsp; The custom code in the form cannot be run.&amp;nbsp; This functionality may be deactivated on the server. For more information contact the server farm administrator.&lt;/p&gt;&lt;p&gt;when you look up the correlation ID in the logs...Error details points to sandbox code service not being able to load type Microsoft.SharePoint.Administration.SPService... see below&lt;/p&gt;&lt;p&gt;&lt;br /&gt;04/19/2014 14:05:24.10 &amp;nbsp;w3wp.exe (0x21A8)&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;0x3088&amp;nbsp;SharePoint Foundation&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Sandboxed Code Service&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;ajrl9&amp;nbsp;High&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; - UserCodeExecutionProxy call failed with solution code itself. ServiceUrl: tcp://server:32846/SPUCExecutionHost; Microsoft.SharePoint.UserCode.SPUserCodeSolutionExecutionFailedException: Unhandled exception was thrown by the sandboxed code wrapper&amp;#39;s Execute method in the partial trust app domain: Could not load type &amp;#39;Microsoft.SharePoint.Administration.SPService&amp;#39; from assembly &amp;#39;Microsoft.SharePoint, Version=15.900.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c&amp;#39;. ---&amp;gt; &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Any thoughts?&amp;nbsp; I know I can fix this by publishing to Central Admin first and then activating to site collection... but why do each of these work separately but not together?&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>