Forms via URL
Forms via URL
There are a couple of methods that can be used to reference or call SharePoint forms through URLs. There are some subtle differences in the way they are called that can have a profound effect on their capabilities.
Direct Call
The method of calling the form directly has some distinct advantages over the use of InfoPath's FormServer (see below).
First and foremost, it is possible to reference an InfoPath form, or template, directly. When this is done, the form's view can also be specified. There is also the optional capability of specifying the ID number of the list item to display in the form. I have not found a way to perform this function with the FormServer.
Base URL
The most important part of the URL is the .aspx file that is to be displayed. This can be a standard SharePoint form or an InfoPath form. The following are the calls to the standard SharePoint forms.
http[s]://site/Lists/listname/DispForm.aspx http[s]://site/Lists/listname/EditForm.aspx http[s]://site/Lists/listname/NewForm.aspx
ID
To specify the ID number of the item to show on the form, use the ID=
parameter.
http[s]://site/Lists/listname/DispForm.aspx?ID=idvalue http[s]://site/Lists/listname/EditForm.aspx?ID=idvalue
It does not make much sense to include the ID=
parameter with the NewForm.aspx
form since it is for a new list item.
IsDlg
Normally, when a form is displayed in a browser, it includes the left-side menu and the vertical scroll bar. When the IsDlg=1
is specified, both the menu and scroll bar are removed.
This parameter is case-sensitive. If any different casing used, the parameter will assume that the parameter is isdlg=
is specified.
The removal of the scroll bar is inconvenient because if the form is greater in length than the current viewing area, navigation is much more difficult. If a scroll bar is desired, use the isdlg=1
option.
http[s]://site/Lists/listname/NewForm.aspx?IsDlg=1
isdlg
The isdlg=1
parameter is similar to the IsDlg=1
parameter. Notice the difference in the casing. When used, the left, vertical scrollbar is retained.
http[s]://site/Lists/listname/NewForm.aspx?isdlg=1
Source
The Source=
parameter is used to specify the site to navigate to when the user has completed the form. In other words, when the user clicks on the Submit or Cancel button, the URL on the Source=
parameter is the next page that is displayed.
http[s]://site/Lists/listname/NewForm.aspx?Source=url
Relative URLs can be used in the Source parameter. If your site URL is the following:
Source=https://www.sharepoint.com/sites/mySharePointSite/default.aspx
The URL can be shortened to the following:
Source=/sites/mySharePointSite/default.aspx
Calling InfoPath Files Directly
If InfoPath is used to develop and publish forms, additional files are added to the list's item
directory. They have the following layouts:
http[s]://site/Lists/listname/item/dispifs.aspx http[s]://site/Lists/listname/item/editifs.aspx http[s]://site/Lists/listname/item/newifs.aspx
Note: If there is a space in the URL, replace each instance of a space with %20
.
InfoPath FormServer
InfoPath Forms Services Architecture for SharePoint 2010How to: Use Query Parameters to Invoke Browser-Enabled InfoPath Forms for SharePoint 2010
When a browser-enabled form is requested and InfoPath is not installed on the computer, InfoPath Forms Services redirects to the FormServer.aspx
page and sends pre-generated JScript code and solution-specific JScript data arrays to the browser. The non-modifiable client-side script array is generated in two parts: when the form template is converted, and when the form is requested. It functions in a manner similar to Asynchronous JavaScript and XML (AJAX) in handling HTML generation and server communication on the client.
On most systems, FormServer.aspx is located in a specific location. The following illustrates the location of the file.
http[s]://site/_layouts/15/FormServer.aspx
In case you were wondering, calling FormServer.aspx
directly results in an error.
ClientInstalled
ClientInstalled
is another QueryString variable that will tell the FormServer.aspx
page that the form should be loaded in the client software. This includes either InfoPath Designer and InfoPath Filler.
DefaultItemOpen
Do not use the DefaultItemOpen
parameter. This has been replaced by the OpenIn
parameter.
DefaultOpen
DefaultOpen
is another query string veriable that tells formserver.aspx
how to load the form.
DefaultView
In many cases in InfoPath, especially when testing, it is helpful to be able to click to go directly to a specific view of a form. Of course, you can always insert a button in a form whose action is to switch views, and use a formatting rule to only show that button to certain people. It is possible to create a hyperlink directly to a specific view of in a form.
DefaultView=viewname
Note: If there is a space in the view name, replace the space with %20
.
IsDlg
Normally, when a form is displayed in a browser, it includes the left-side menu and the vertical scroll bar. When the IsDlg=1
is specified, both the menu and scroll bar are removed.
This parameter is case-sensitive. If any different casing used, the parameter will assume that the parameter is isdlg=
is specified.
The removal of the scroll bar is inconvenient because if the form is greater in length than the current viewing area, navigation is much more difficult. If a scroll bar is desired, use the isdlg=1
option.
isdlg
The isdlg=1
parameter is similar to the IsDlg=1
parameter. Notice the difference in the casing. When used, the left, vertical scrollbar is retained.
OpenIn
The OpenIn
optional parameter tells Forms Services how you prefer to open the form template. The default and preferred setting is to use the InfoPath client (i.e. InfoPath Filler). If that is not available, or installed on the client machine, the fall back is to display the form in the browser. This is represented by the PreferClient
value. But if you specify that only the InfoPath client is to be used, set this parameter to Client
If you prefer to only use the browser to display the form, regardless if InfoPath Designer or InfoPath Filler is installed, set the paramter to Browser
.
If you specify to use only the InfoPath client (i.e. Client
) and the client program is not installed or not available, the form will not open in the browser but will instead fail.
There are four values that could be assigned to thie parameter. They are:
Browser
Client
PreferClient
Mobile
If a Source query parameter is specified, the default value is Browser
.
If XmlLocation is specified, the default value is the setting used in the library.
If only XsnLocation is specified, the default value is PreferClient
.
If OpenIn=Mobile
is specified, the form will be redirected to the MobileFormServer.aspx
page for rendering. Since mobile devices should be automatically detected, you should never need to use this value. But you might find that some mobile devices may not be properly recognized. In such cases, the existence of the Mobile
value would enforce the page to be rendered appropriately for those mobile systems. The form template must be enabled for mobile support or an error message will be returned.
Options
There is an Options
parameter, however, it is rarely used. The only purpose of this parameter is to disable Save By by using the value DisableSave
(i.e. Options=DisableSave
). When this is used, the Save, Save As, and Close buttons are not shown. Even if SaveLocation
is used, the Options=DisableSave
has precedence.
The Options
parameter exists as a way to provide forward compatibility with future versions of Forms Services.
Source
The Source
parameter is used to specify the site to navigate to when the user has completed the form. In other words, when the user clicks on the Submit or Cancel button, the URL on the Source=
parameter is the next page that is displayed.
http[s]://site/Lists/listname/NewForm.aspx?Source=url
Relative URLs can be used in the Source parameter. If your site URL is the following:
Source=https://www.sharepoint.com/sites/mySharePointSite/default.aspx
The URL can be shortened to the following:
Source=/sites/mySharePointSite/default.aspx
%Workflow Context:Current Site URL%
%Workflow Context:Current Site URL%
returns the URL of the current site where the workflow is running.
XmlLocation
This parameter is used to open an existing form.
The XmlLocation
and XsnLocation
properties are mutually exclusive; specifying values for both parameters will result in an error.
XsnLocation
This parameter is used to open a new form that is based on a form template. If an XsnLocation
is specified in a URL using FormServer.aspx
, the SaveLocation
parameter should also be specified if the Save and Save As buttons must be displayed.
The Source
parameter should also be specified or the message "The form has been closed" will appear when the user closes the form.
The XmlLocation
and XsnLocation
properties are mutually exclusive; specifying values for both parameters will result in an error.
http[s]://site/_layouts/15/FormServer.aspx?XsnLocation=http[s]://site/Lists/listname/Item/template.xsn
It is possible to shorten the URL used in XsnLocation by using the /sites/
token.
Check %Workflow Context:Current Item URL%