开发者

Get the current URL of InfoPath form

开发者 https://www.devze.com 2023-02-19 03:28 出处:网络
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

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 开发者_如何学Gothe form etc... but what I'm looking for is to get the full URL of the form, among with the querystring parameters?! Thanks.


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.


Your code behind should have the following:

/// <summary>
/// NOTE: The following procedure is required by Microsoft Office InfoPath.
/// It can be modified using Microsoft Office InfoPath.
/// </summary>
private void InternalStartup()
{
    this.EventManager.FormEvents.Loading += this.FormEventsLoading;
}

private void FormEventsLoading(object sender, LoadingEventArgs e)
{

}

The LoadingEventArgs parameter can get you the querystring parameters as value = e.InputParameters["Key"];

0

精彩评论

暂无评论...
验证码 换一张
取 消