Shared network, managed code error - InfoPath Dev Sign in | Join | Help in Code InfoPath (Entire Site) InfoPath Dev InfoPath Dev is dedicated to bringing you the information and tools you need to be successful in your Microsoft Office InfoPath development projects. Home Blogs Forums Photos Downloads InfoPath Dev » InfoPath » Code » Shared network, managed code error Use our Google Custom Search for best site search results. Shared network, managed code error Last post 11-17-2016 02:22 PM by Hilary Stoupa. 35 replies. Page 1 of 3 (36 items) 1 2 3 Next > Sort Posts: Oldest to newest Newest to oldest Previous Next 09-12-2016 10:20 AM AndreaP Joined on 08-26-2016 Posts 33 Shared network, managed code error Reply Contact Hi !! As I always say, I'm a newbie with InfoPath but I managed to learn a lot! I made a form that has a managed code where are these two very important codes: SetSaveAsDialogLocation and SetSaveAsDialogFilename. They work, wouhou! They work on my computer, a Windows 8 and they work on my collegue's computer, also a Windows 8. But we also use what we call a 'Terminal Server', an emulator which allows us to use Windows when we are on Linux computers.On that platform, the form does not work! The error message is 'InfoPath cannot open the selected form because of an error in the form's code. Policy settings prevent opening Internet forms with managed code. To fix this problem, contact your system administrator.'So I researched that error and it lead me to https://support.microsoft.com/en-ca/kb-2827915The problem with their solution is that they publish it on SharePoint, what I do not do. I published the form on a shared repertory. So it is not a website that I can tell the computer to 'trust' ... As soon as I remove the code, everything works but there is not specified location for the saving and no predetermined name which is very important... Is there a way to configure those without coding? Or is there a solution to my problem? Also, I found this: www.infopathdev.com/forums/p/14722/52363.aspx where it says to put the dfs address... is that only for VB? Should I use dfs for the location path?That's my code: (I put blablabla for confidentiality) using Microsoft.Office.InfoPath;using System;using System.Windows.Forms;using System.Xml;using System.Xml.XPath;using mshtml;namespace _._._{ public partial class FormCode { // Les variables membres ne sont pas prises en charge dans les formulaires activés pour le navigateur. // À la place, écrire et lire ces valeurs à partir de FormState // dictionnaire utilisant du code tel que le suivant : // // private object _memberVariable // { // get // { // return FormState["_memberVariable"]; // } // set // { // FormState["_memberVariable"] = value; // } // } // REMARQUE : la procédure suivante est requise par Microsoft InfoPath. // Elle peut être modifiée à l’aide de Microsoft InfoPath. public void InternalStartup() { EventManager.FormEvents.Save += new SaveEventHandler(FormEvents_Save); } public void FormEvents_Save(object sender, SaveEventArgs e) { // Tapez ici le code à exécuter avant une opération « Enregistrer » ou « Enregistrer sous ». string day = MainDataSource.CreateNavigator().SelectSingleNode("/my:mesChamps/my:menu/my:datetime/my:day", NamespaceManager).Value; string month = MainDataSource.CreateNavigator().SelectSingleNode("/my:mesChamps/my:menu/my:datetime/my:month", NamespaceManager).Value; string year = MainDataSource.CreateNavigator().SelectSingleNode("/my:mesChamps/my:menu/my:datetime/my:year", NamespaceManager).Value; string hour = MainDataSource.CreateNavigator().SelectSingleNode("/my:mesChamps/my:menu/my:datetime/my:hour", NamespaceManager).Value; string minute = MainDataSource.CreateNavigator().SelectSingleNode("/my:mesChamps/my:menu/my:datetime/my:minute", NamespaceManager).Value; string type = MainDataSource.CreateNavigator().SelectSingleNode("/my:mesChamps/my:appel/my:info/my:degre", NamespaceManager).Value; string location = MainDataSource.CreateNavigator().SelectSingleNode("/my:mesChamps/my:appel/my:info/my:location_scroll", NamespaceManager).Value; this.SetSaveAsDialogLocation("\\blablabla\\shares\\s\\STL_COMMUN\\TVE\\TVE_2016\\formulaires"); this.SetSaveAsDialogFilename(year + "-" + month + "-" + day + "-" + hour + minute + "Z" + "-" + location + "-" + type + ".xml"); // La propriété Dirty sera définie sur false si l'enregistrement est réussi. e.PerformSaveOperation(); // Tapez ici le code à exécuter après l'enregistrement. e.CancelableArgs.Cancel = false; } }} Filed under: save as, Managed Code, C#, Code, Begginer, file name, .NET, 2010, filepath 09-12-2016 02:21 PM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,242 Re: Shared network, managed code error Mark as Not AnswerMark as Answer... Reply Contact Yeah, that KB directly is talking about issues w/ a SharePoint published form, not a network published form. You could set the form to full trust & sign it with a code signing cert. But you are publishing the form to the network location, not just copying the template file there? Hilary Stoupa 09-16-2016 08:15 AM In reply to AndreaP Joined on 08-26-2016 Posts 33 Re: Shared network, managed code error Mark as Not AnswerMark as Answer... Reply Contact Yes I published it there but it won't work...I created the name of my access to this repertory on my personal computer and I chose Z: but the others can chose any letter they want... So how can I write an absolute path ? 09-16-2016 09:12 AM In reply to AndreaP Joined on 08-26-2016 Posts 33 Re: Shared network, managed code error Mark as Not AnswerMark as Answer... Reply Contact Also the full trust, it asks me to create a certificate, which I don't know how... 09-17-2016 07:13 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,242 Re: Shared network, managed code error scr.png Mark as Not AnswerMark as Answer... Reply Contact Replying to "how can I write an absolute path" - see the attached screenshot. Use the full server path in this dialog, not "z:\shareddocs" or whatever but \\servername\shareddocs. Hilary Stoupa 10-06-2016 07:08 AM In reply to AndreaP Joined on 08-26-2016 Posts 33 Re: Shared network, managed code error Mark as Not AnswerMark as Answer... Reply Contact Ok so now I have a new problem... This is my code: using Microsoft.Office.InfoPath;using System;using System.Windows.Forms;using System.Xml;using System.Xml.XPath;using mshtml;namespace _._._{ public partial class FormCode { // Les variables membres ne sont pas prises en charge dans les formulaires activés pour le navigateur. // À la place, écrire et lire ces valeurs à partir de FormState // dictionnaire utilisant du code tel que le suivant : // // private object _memberVariable // { // get // { // return FormState["_memberVariable"]; // } // set // { // FormState["_memberVariable"] = value; // } // } // REMARQUE : la procédure suivante est requise par Microsoft InfoPath. // Elle peut être modifiée à l’aide de Microsoft InfoPath. public void InternalStartup() { EventManager.FormEvents.Save += new SaveEventHandler(FormEvents_Save); } public void FormEvents_Save(object sender, SaveEventArgs e) { // Tapez ici le code à exécuter avant une opération « Enregistrer » ou « Enregistrer sous ». string day = MainDataSource.CreateNavigator().SelectSingleNode("/my:mesChamps/my:menu/my:datetime/my:day", NamespaceManager).Value; string month = MainDataSource.CreateNavigator().SelectSingleNode("/my:mesChamps/my:menu/my:datetime/my:month", NamespaceManager).Value; string year = MainDataSource.CreateNavigator().SelectSingleNode("/my:mesChamps/my:menu/my:datetime/my:year", NamespaceManager).Value; string hour = MainDataSource.CreateNavigator().SelectSingleNode("/my:mesChamps/my:menu/my:datetime/my:hour", NamespaceManager).Value; string minute = MainDataSource.CreateNavigator().SelectSingleNode("/my:mesChamps/my:menu/my:datetime/my:minute", NamespaceManager).Value; string type = MainDataSource.CreateNavigator().SelectSingleNode("/my:mesChamps/my:appel/my:info/my:degre", NamespaceManager).Value; string location = MainDataSource.CreateNavigator().SelectSingleNode("/my:mesChamps/my:appel/my:info/my:location_scroll", NamespaceManager).Value; this.SetSaveAsDialogLocation("Z:\\STL_COMMUN\\TVE\\TVE_2016\\formulaires"); this.SetSaveAsDialogFilename(year + "-" + month + "-" + day + "-" + hour + minute + "Z" + "-" + location + "-" + type + ".xml"); // La propriété Dirty sera définie sur false si l'enregistrement est réussi. e.PerformSaveOperation(); // Tapez ici le code à exécuter après l'enregistrement. e.CancelableArgs.Cancel = false; } }} I got the error that many names didn't exist in the actual context and that there are no definitions for certains words...how do I fix that? :'( 10-06-2016 07:51 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,242 Re: Shared network, managed code error Mark as Not AnswerMark as Answer... Reply Contact Perhaps you have your form compatibility set to browser instead of filler? Hilary Stoupa 10-06-2016 07:55 AM In reply to AndreaP Joined on 08-26-2016 Posts 33 Re: Shared network, managed code error Mark as Not AnswerMark as Answer... Reply Contact Where do we find that? 10-06-2016 08:03 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,242 Re: Shared network, managed code error Mark as Not AnswerMark as Answer... Reply Contact Under Form Options > Compatibility Hilary Stoupa 10-06-2016 08:29 AM In reply to AndreaP Joined on 08-26-2016 Posts 33 Re: Shared network, managed code error Mark as Not AnswerMark as Answer... Reply Contact It's in Filler mode! 10-06-2016 08:31 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,242 Re: Shared network, managed code error Mark as Not AnswerMark as Answer... Reply Contact Then I don't know why your code won't compile without more information. Maybe you can attach some screenshots of the issues under the Options tab. Hilary Stoupa 10-06-2016 08:47 AM In reply to AndreaP Joined on 08-26-2016 Posts 33 Re: Shared network, managed code error Mark as Not AnswerMark as Answer... Reply Contact Ok it works now! New problem.The first way I published it was like this with the wizard: The first step in a x location:And the second step where x is. Error message: The form model associated to this form is unaccessible or has been moved. The model of the form on your computer has the same form ID as the model associated, but is in a different location.Location of the model associated: xLocation of origin of the form model on your computer: x (exact same location!)Verify that you can access the location of the form model associated and try again to open the form if this solution doesn't work, ask the author of the form to update it. Then I tried this:Published in x:And then, published in a folder where x is:Error message: Impossible to open this form because it requires a security level of the domain while it only has a restricted autorisation. To solve this problem, open the form from the location where it has been published. What do I do :( 10-06-2016 08:50 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,242 Re: Shared network, managed code error Mark as Not AnswerMark as Answer... Reply Contact What was the issue? Also, your screenshots don't show for me. Can you attach them under the Options tab? Hilary Stoupa 10-06-2016 09:07 AM In reply to AndreaP Joined on 08-26-2016 Posts 33 Re: Shared network, managed code error Capture.PNG Mark as Not AnswerMark as Answer... Reply Contact I couldn't open the form in the filler mode because of the first error and then because of the second error. I feel like as soon as I put the code, they won't allow me to open it for security reasons? For the screenshot, I can't find how to put more than one image... But here's one. On the first way I did it, it was folder x, next step folder xand the second way I did it was folder x and next step was folder y which is in folder x 10-06-2016 09:26 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,242 Re: Shared network, managed code error Mark as Not AnswerMark as Answer... Reply Contact You code should only require domain trust, but it continues to sound to me as if you aren't publishing correctly, or aren't opening from the published location. If publishing to a network folder, in the second dialog, you should use the \\servername\folder etc. path, not including the mapped drive letter. Perhaps you have an incorrectly published version of the form in your cache? Open InfoPath Filler, go to New and right click and select "Remove" for any previously published versions of your form. You can also attach a copy of your template under the Options tab in a reply and I can test publish it to see if I have the same results. Hilary Stoupa Page 1 of 3 (36 items) 1 2 3 Next > Copyright © 2003-2019 Qdabra Software. All rights reserved.View our Terms of Use.
Use our Google Custom Search for best site search results.
Hi !!
As I always say, I'm a newbie with InfoPath but I managed to learn a lot!
I made a form that has a managed code where are these two very important codes: SetSaveAsDialogLocation and SetSaveAsDialogFilename. They work, wouhou!
They work on my computer, a Windows 8 and they work on my collegue's computer, also a Windows 8. But we also use what we call a 'Terminal Server', an emulator which allows us to use Windows when we are on Linux computers.On that platform, the form does not work! The error message is 'InfoPath cannot open the selected form because of an error in the form's code. Policy settings prevent opening Internet forms with managed code. To fix this problem, contact your system administrator.'
So I researched that error and it lead me to https://support.microsoft.com/en-ca/kb-2827915The problem with their solution is that they publish it on SharePoint, what I do not do. I published the form on a shared repertory. So it is not a website that I can tell the computer to 'trust' ...
As soon as I remove the code, everything works but there is not specified location for the saving and no predetermined name which is very important... Is there a way to configure those without coding? Or is there a solution to my problem?
Also, I found this: www.infopathdev.com/forums/p/14722/52363.aspx where it says to put the dfs address... is that only for VB? Should I use dfs for the location path?
That's my code: (I put blablabla for confidentiality)
using Microsoft.Office.InfoPath;using System;using System.Windows.Forms;using System.Xml;using System.Xml.XPath;using mshtml;namespace _._._{ public partial class FormCode { // Les variables membres ne sont pas prises en charge dans les formulaires activés pour le navigateur. // À la place, écrire et lire ces valeurs à partir de FormState // dictionnaire utilisant du code tel que le suivant : // // private object _memberVariable // { // get // { // return FormState["_memberVariable"]; // } // set // { // FormState["_memberVariable"] = value; // } // } // REMARQUE : la procédure suivante est requise par Microsoft InfoPath. // Elle peut être modifiée à l’aide de Microsoft InfoPath. public void InternalStartup() { EventManager.FormEvents.Save += new SaveEventHandler(FormEvents_Save); } public void FormEvents_Save(object sender, SaveEventArgs e) { // Tapez ici le code à exécuter avant une opération « Enregistrer » ou « Enregistrer sous ». string day = MainDataSource.CreateNavigator().SelectSingleNode("/my:mesChamps/my:menu/my:datetime/my:day", NamespaceManager).Value; string month = MainDataSource.CreateNavigator().SelectSingleNode("/my:mesChamps/my:menu/my:datetime/my:month", NamespaceManager).Value; string year = MainDataSource.CreateNavigator().SelectSingleNode("/my:mesChamps/my:menu/my:datetime/my:year", NamespaceManager).Value; string hour = MainDataSource.CreateNavigator().SelectSingleNode("/my:mesChamps/my:menu/my:datetime/my:hour", NamespaceManager).Value; string minute = MainDataSource.CreateNavigator().SelectSingleNode("/my:mesChamps/my:menu/my:datetime/my:minute", NamespaceManager).Value; string type = MainDataSource.CreateNavigator().SelectSingleNode("/my:mesChamps/my:appel/my:info/my:degre", NamespaceManager).Value; string location = MainDataSource.CreateNavigator().SelectSingleNode("/my:mesChamps/my:appel/my:info/my:location_scroll", NamespaceManager).Value; this.SetSaveAsDialogLocation("\\blablabla\\shares\\s\\STL_COMMUN\\TVE\\TVE_2016\\formulaires"); this.SetSaveAsDialogFilename(year + "-" + month + "-" + day + "-" + hour + minute + "Z" + "-" + location + "-" + type + ".xml"); // La propriété Dirty sera définie sur false si l'enregistrement est réussi. e.PerformSaveOperation(); // Tapez ici le code à exécuter après l'enregistrement. e.CancelableArgs.Cancel = false; } }}
Yes I published it there but it won't work...
I created the name of my access to this repertory on my personal computer and I chose Z: but the others can chose any letter they want... So how can I write an absolute path ?
Also the full trust, it asks me to create a certificate, which I don't know how...
Ok so now I have a new problem...
This is my code:
using Microsoft.Office.InfoPath;using System;using System.Windows.Forms;using System.Xml;using System.Xml.XPath;using mshtml;namespace _._._{ public partial class FormCode { // Les variables membres ne sont pas prises en charge dans les formulaires activés pour le navigateur. // À la place, écrire et lire ces valeurs à partir de FormState // dictionnaire utilisant du code tel que le suivant : // // private object _memberVariable // { // get // { // return FormState["_memberVariable"]; // } // set // { // FormState["_memberVariable"] = value; // } // } // REMARQUE : la procédure suivante est requise par Microsoft InfoPath. // Elle peut être modifiée à l’aide de Microsoft InfoPath. public void InternalStartup() { EventManager.FormEvents.Save += new SaveEventHandler(FormEvents_Save); } public void FormEvents_Save(object sender, SaveEventArgs e) { // Tapez ici le code à exécuter avant une opération « Enregistrer » ou « Enregistrer sous ». string day = MainDataSource.CreateNavigator().SelectSingleNode("/my:mesChamps/my:menu/my:datetime/my:day", NamespaceManager).Value; string month = MainDataSource.CreateNavigator().SelectSingleNode("/my:mesChamps/my:menu/my:datetime/my:month", NamespaceManager).Value; string year = MainDataSource.CreateNavigator().SelectSingleNode("/my:mesChamps/my:menu/my:datetime/my:year", NamespaceManager).Value; string hour = MainDataSource.CreateNavigator().SelectSingleNode("/my:mesChamps/my:menu/my:datetime/my:hour", NamespaceManager).Value; string minute = MainDataSource.CreateNavigator().SelectSingleNode("/my:mesChamps/my:menu/my:datetime/my:minute", NamespaceManager).Value; string type = MainDataSource.CreateNavigator().SelectSingleNode("/my:mesChamps/my:appel/my:info/my:degre", NamespaceManager).Value; string location = MainDataSource.CreateNavigator().SelectSingleNode("/my:mesChamps/my:appel/my:info/my:location_scroll", NamespaceManager).Value; this.SetSaveAsDialogLocation("Z:\\STL_COMMUN\\TVE\\TVE_2016\\formulaires"); this.SetSaveAsDialogFilename(year + "-" + month + "-" + day + "-" + hour + minute + "Z" + "-" + location + "-" + type + ".xml"); // La propriété Dirty sera définie sur false si l'enregistrement est réussi. e.PerformSaveOperation(); // Tapez ici le code à exécuter après l'enregistrement. e.CancelableArgs.Cancel = false; } }}
I got the error that many names didn't exist in the actual context and that there are no definitions for certains words...how do I fix that? :'(
Where do we find that?
It's in Filler mode!
Ok it works now!
New problem.
The first way I published it was like this with the wizard:
The first step in a x location:And the second step where x is.
Error message: The form model associated to this form is unaccessible or has been moved. The model of the form on your computer has the same form ID as the model associated, but is in a different location.Location of the model associated: xLocation of origin of the form model on your computer: x (exact same location!)Verify that you can access the location of the form model associated and try again to open the form if this solution doesn't work, ask the author of the form to update it.
Then I tried this:
Published in x:And then, published in a folder where x is:
Error message: Impossible to open this form because it requires a security level of the domain while it only has a restricted autorisation. To solve this problem, open the form from the location where it has been published.
What do I do :(
I couldn't open the form in the filler mode because of the first error and then because of the second error. I feel like as soon as I put the code, they won't allow me to open it for security reasons?
For the screenshot, I can't find how to put more than one image... But here's one. On the first way I did it, it was folder x, next step folder x
and the second way I did it was folder x and next step was folder y which is in folder x