SharePoint 2010 Using Parameters in InfoPath forms

If you would like to pass parameters into an InfoPath form, for example to call specific data into the form you can do it really easy. In my case we are using code behind, i am not sure if you can read parameters without using code, but if it is possible please let me know.

As i said you need to add code behind into your form, in order to access the parameters. Afterwords you have to insert the form loading event and use these lines of code:

[sourcecode language=”csharp”]

public void FormEvents_Loading(object sender, LoadingEventArgs e)
//Getting the Parameters from Url
string para_ticketId = string.Empty;
para_ticketId = e.InputParameters[“ticketId”];

//Setting Parameter into Field of Form
XPathNavigator navForm = this.CreateNavigator();
XmlNamespaceManager NS = this.NamespaceManager;

navForm.SelectSingleNode(“/my:meineFelder/my:TicketID”, NS).SetValue(para_ticketId);



By using the e.InputParameters[“yourparameter”] you can access the values of the parameter. By using the contains key you can check if the parameter is attached to the url. This is important that you don’t get an error message cause the parameter is missing. It’s better to check it by yourself and give a nice error message to the user.

Now your InfoPath form can read the parameter and write it into any field you like. If you open the InfoPath form by using this adress:


The InfoPath form writes this value “ilikesharepoint” into the desired field:

Hope this helps you a little bit. If you would like to know more about, i recommend you to read this great post.


The article or information provided here represents completely my own personal view & thought. It is recommended to test the content or scripts of the site in the lab, before making use in the production environment & use it completely at your own risk. The articles, scripts, suggestions or tricks published on the site are provided AS-IS with no warranties or guarantees and confers no rights.

About Karsten Schneider 312 Articles
Consultant for Microsoft 365 Applications with a strong focus in Teams, SharePoint Online, OneDrive for Business as well as PowerPlatform with PowerApps, Flow and PowerBI. I provide Workshops for Governance & Security in Office 365 and Development of Solutions in the area of Collaboration and Teamwork based on Microsoft 365 and Azure Cloud Solutions. In his free time he tries to collect tipps and worthy experience in this blog.


Leave a Reply

Your email address will not be published.