<?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: Using code to save locally with "domain" as trust level</title><link>https://www.infopathdev.com:443/forums/thread/123774.aspx</link><pubDate>Tue, 05 Jan 2021 15:42:10 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:123774</guid><dc:creator>steven</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/123774.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=123774</wfw:commentRss><description>Thanks Hilary, this is quite clear. So I guess my method can not be implemented.</description></item><item><title>Re: Using code to save locally with "domain" as trust level</title><link>https://www.infopathdev.com:443/forums/thread/123772.aspx</link><pubDate>Mon, 04 Jan 2021 19:43:37 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:123772</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/123772.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=123772</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;As per the documentation, this will require full trust:&lt;/p&gt;&lt;p&gt;&lt;a href="https://docs.microsoft.com/en-us/previous-versions/office/infopath-form/aa947229(v=office.15)#remarks"&gt;https://docs.microsoft.com/en-us/previous-versions/office/infopath-form/aa947229(v=office.15)#remarks&lt;/a&gt;&lt;/p&gt;&lt;blockquote style="margin-right:0px;" dir="ltr"&gt;&lt;p&gt;This member can be accessed only by forms opened from a form template that has been configured to run with full trust using the Security and Trust category of the Form Options dialog box. This member requires full trust for the immediate caller and cannot be used by partially trusted code.&amp;nbsp;&lt;/p&gt;&lt;/blockquote&gt;</description></item><item><title>Re: Using code to save locally with "domain" as trust level</title><link>https://www.infopathdev.com:443/forums/thread/123765.aspx</link><pubDate>Thu, 24 Dec 2020 07:57:16 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:123765</guid><dc:creator>steven</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/123765.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=123765</wfw:commentRss><description>&lt;p&gt;Thansk for your reply. The problem is, we will be using it on a company intranet. This environment does not support Visual Studio, so I can not program inside the intranet. That means I am doing the coding on my personal laptop, and then move the file to the company&amp;#39;s intranet. This way the code is still intact, but I do need the full trust, which the company does not allow for.&lt;/p&gt;

&lt;p&gt;So you reckon it is impossible to use the code as I did with a Domain trust level?&lt;/p&gt;</description></item><item><title>Re: Using code to save locally with "domain" as trust level</title><link>https://www.infopathdev.com:443/forums/thread/123764.aspx</link><pubDate>Wed, 23 Dec 2020 22:15:57 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:123764</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/123764.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=123764</wfw:commentRss><description>So - I think you&amp;#39;ll end up needing to be full trust here, but I&amp;#39;m wondering about your comment that you are moving this form. If you publish it instead, and open from the published location, is Full Trust ok?</description></item><item><title>Using code to save locally with "domain" as trust level</title><link>https://www.infopathdev.com:443/forums/thread/123761.aspx</link><pubDate>Wed, 23 Dec 2020 10:29:45 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:123761</guid><dc:creator>steven</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/123761.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=123761</wfw:commentRss><description>&lt;p&gt; I am making a form that will be used by people on the exact same computer and then it will be saved locally. It is to store data for delivery guys, so they fill in some information on a form and then head out. Now at night, all these forms will be processed by another script (using Robotic Process Automation). &lt;/p&gt;


&lt;p&gt;So I needed to make a button that would save the form locally with a certain unique filename and would then close the form. This all works fine on my local machine, with a &amp;quot;full trust&amp;quot; security level and using the following code:&lt;/p&gt;



&lt;p&gt;     
&lt;pre class="tab"&gt;public void CTRL1_5_Clicked(object sender, ClickedEventArgs e)&lt;/pre&gt;
&lt;pre class="tab"&gt;        {&lt;/pre&gt;
&lt;pre class="tab"&gt;            string projectTitle = this.MainDataSource.CreateNavigator().SelectSingleNode(&amp;quot;/my:myFields/my:ID&amp;quot;, this.NamespaceManager).Value; if (projectTitle == null || projectTitle == &amp;quot;&amp;quot;)&lt;/pre&gt;
&lt;pre class="tab"&gt;            {&lt;/pre&gt;
&lt;pre class="tab"&gt;                projectTitle = &amp;quot;IncorrectIdentifier&amp;quot;;&lt;/pre&gt;
&lt;pre class="tab"&gt;            }&lt;/pre&gt;

&lt;pre class="tab"&gt;            string currentDirect = Directory.GetCurrentDirectory(); &lt;/pre&gt;

&lt;pre class="tab"&gt;            this.SaveAs(currentDirect + &amp;quot;/&amp;quot; + projectTitle + &amp;quot;.XML&amp;quot;);&lt;/pre&gt;

&lt;pre class="tab"&gt;            //the line below also closes the application. If one need to just close the form, use this.Close() instead.&lt;/pre&gt;
&lt;pre class="tab"&gt;            //System.Environment.Exit(0);  &lt;/pre&gt;

&lt;pre class="tab"&gt;        }  &lt;/pre&gt;


&lt;p&gt;Now the problem arises when I move this form into my work environment. By the system settings it will not allow a form with &amp;quot;Full trust&amp;quot;. So I thought to change the trust level to &amp;quot;domain&amp;quot;, but then it seems that all the &amp;quot;System.IO&amp;quot; calls (such as &amp;quot;Directory.GetCurrentDirectory()&amp;quot; or more importantly &amp;quot;this.SaveAs&amp;quot; and &amp;quot;System.Environment.Exit(0)&amp;quot; )  will not work.&lt;/p&gt;


&lt;p&gt;I do not think I can reach my system administrator to allow for full trust forms. So I really wonder whether it is possible to save a file within a domain trust setting. The file will be stored locally, in the same map as the form is openend, so the user account from which the form is accessed will have rights to read and write within the folder. But I still get the following error:&lt;/p&gt;


&lt;pre class="tab"&gt;    Request for the permission of type &amp;#39;System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&amp;#39; failed.&lt;/pre&gt;
&lt;pre class="tab"&gt;       at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark&amp;amp; stackMark, Boolean isPermSet)&lt;/pre&gt;
&lt;pre class="tab"&gt;       at System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission cap, StackCrawlMark&amp;amp; stackMark)&lt;/pre&gt;
&lt;pre class="tab"&gt;       at System.Security.CodeAccessPermission.Demand()&lt;/pre&gt;
&lt;pre class="tab"&gt;       at System.Security.Permissions.FileIOPermission.QuickDemand(FileIOPermissionAccess access, String fullPath, Boolean checkForDuplicates, Boolean needFullPath)&lt;/pre&gt;
&lt;pre class="tab"&gt;       at System.IO.Directory.InternalGetCurrentDirectory(Boolean checkHost)&lt;/pre&gt;
&lt;pre class="tab"&gt;       at System.IO.Directory.GetCurrentDirectory()&lt;/pre&gt;
&lt;pre class="tab"&gt;       at coded.FormCode.CTRL1_5_Clicked(Object sender, ClickedEventArgs e)&lt;/pre&gt;
&lt;pre class="tab"&gt;       at Microsoft.Office.InfoPath.Internal.ButtonEventHost.OnButtonClick(DocActionEvent pEvent)&lt;/pre&gt;
&lt;pre class="tab"&gt;       at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)&lt;/pre&gt;


&lt;p&gt;This is pointed to the &amp;quot;GetCurrentDirectory&amp;quot; command, but if I change that it will point to the &amp;quot;SaveAs&amp;quot; command and if I change that it will point to the &amp;quot;Environment.Exit&amp;quot; command. And I basically need all three.&lt;/p&gt;

Any help would be much appreciated.</description></item></channel></rss>