Search code examples
sharepointsharepoint-2010infopath

Get the current URL of InfoPath form


Is there a way in InfoPath 2010 to get the URL of the form which is published on a SharePoint site? I know there are built-in functions for retrieving URLs of the sharepoint root site, the Sharepoint list of the form etc... but what I'm looking for is to get the full URL of the form, among with the querystring parameters?! Thanks.


Solution

  • Because the current URL includes the file name, if you know the file name and the current site, you can figure out the URL. I usually have my forms submit with a standard name made up of the user that was filling out the form, and a time stamp. I save that information in a hidden field, then when it comes time to submit I use that as the file name.

    If you want the query string, that's another issue all together. Check out this blog post from the InfoPath team on how to pass in a query sting parameter (warning: only one paramater allowed) http://blogs.msdn.com/b/infopath/archive/2010/06/03/how-to-pass-querystring-data-into-an-infopath-form.aspx You have to host the InfoPath form in a webpart.

    If you're willing to drop into code, there's more options for getting the current query string.