Wednesday, December 7, 2016

Command-line switches for InfoPath

Command-line switches for InfoPath

The command that starts Microsoft InfoPath 2010 is infopath.exe. A command-line switch is the addition of a forward slash followed by the command name and any parameters.

In this article

What are commands and switches?

Use a switch one time by adding it to the Run command

Make a switch available for reuse by creating a shortcut

Available switches and parameters

What are commands and switches?

Each time that you start the program, you run the infopath.exe command, although you do not usually type the command or even see it. You can change certain aspects of how the program starts by adding subcommands called switches to the infopath.exe command.

A switch appears as a space after the main command, followed by a forward slash and the name of the switch, which provide additional information about how to execute the command.

Top of Page

Use a switch one time by adding it to the Run command

First, verify the location of the infopath.exe file on your computer. If you accepted the default folder locations when you installed InfoPath 2010, the infopath.exe file is located at the following:

c:\program files\microsoft office\office14\infopath.exe

Note: If you have installed the InfoPath 2010 32-bit version and your computer is running a Windows 64-bit operating system, use c:\program files (x86)\microsoft office\office14\infopath.exe.

If you do not find the infopath.exe file at that location, search for the file and note the full path.

  1. Do one of the following:

    • Windows 7 and Windows Vista    

      • Click the Start button, point to All Programs, click Accessories, and then click Run.

    • Windows XP    

      • Click the Windows Start button, and then click Run.

  2. In the Run dialog box, type a quotation mark, enter the full path for the infopath.exe file, and then type another quotation mark. Alternatively, click Browse to locate and select the file. In this case, the quotation marks are supplied automatically.

  3. After the closing quotation mark, type a space, and then type the switch. For example, you might type:

    "c:\program files\microsoft office\office14\infopath.exe" /embedding

The next time that you start InfoPath 2010, the program opens as usual. To make your customized startup available for repeated uses, see the next section.

Note: 

  • Switches are not case-sensitive. For example, /EMBEDDING functions the same as /embedding.

  • Remember to include one blank space before the switch and one before each parameter.

Top of Page

Make a switch available for reuse by creating a shortcut

To make your customized startup settings available for repeated use, you can save them on your desktop as a shortcut. To complete this procedure you must first verify the location of the InfoPath.exe file on your computer. If you accepted the default folder locations when you installed InfoPath, the infopath.exe file is probably located at. C:\Program Files\Microsoft Office\Office 14\. If you do not find the infopath.exe file at that location, search for the file and make a note of the full path.

  1. Right-click the Windows desktop, point to New, and then click Shortcut on the shortcut menu.

  2. In the Create Shortcut Wizard, in the Type the location of the item box, type a double quotation mark, the full path for the infopath.exe file (including the file name), and then a double quotation mark.

  3. After the double quotation mark, type a space followed by the switch and any parameters that you want to use. For example, you might type: "C:\Program Files\Microsoft Office\Office14\infopath.exe" \\Reports\NewForms\ExpenseReportTemplate.xsn /InputParameters department=10&organization=325.

    Note: 

    • Switches are not case-sensitive. For example, /EMBEDDING functions the same as /embedding.

    • Remember to include one blank space before the switch and one before each parameter.

  4. Click Next.

  5. In the Type a name for this shortcut box, type a name for the shortcut, and then click Finish. The wizard creates the shortcut and places it on the desktop.

You can create a variety of shortcuts, each of which applies different switches and parameters to the program at startup.

Top of Page

Available switches and parameters

The following table lists all of the switches and parameters that are available in InfoPath.

Switch and Parameter

Description

form

Opens the specified form so that you can fill it out. The name of the form can be a file name, a fully qualified path and file name, or a Uniform Resource Name (URN).

Example    To start InfoPath and open the form MyForm.xml, type the following:

"C:\Program Files\Microsoft Office\Office14\infopath.exe" "C:\New Forms\MyForm.xml"

form template

Opens a new form, based on the specified form template, so that you can fill it out. The name of the form can be a file name, a fully qualified path and file name, or a URN.

Example    To start InfoPath and open a new form based on the form template ExpenseReportTemplate.xsn, type the following:

"C:\Program Files\Microsoft Office\Office14\infopath.exe" ExpenseReportTemplate.xsn

form template /InputParameters param1=value&param2=value&param3=value

Opens a new form, based on the form template published to a shared network location, and passes the parameters to the form. The form template must have managed code or script to process the parameters in the /InputParameters option. The name of the form template can be a file name, a fully qualified path and file name, or a URN.

The parameter list starts after the /InputParameters option with a space, and is then followed by the name of the parameter, an equal sign (=), and the value of the parameter. Each parameter is separated by an ampersand (&). Do not use a space between the ampersand and each parameter.

A parameter name without a value is passed as a parameter with a null value, and a value without a corresponding parameter name is ignored.

For more information about processing input parameters, see the InfoPath developers reference.

Example    Imagine that you have a form template, ExpenseReportTemplate.xsn, with a script that can process two input parameters called department and organization. The form template was published to a shared network folder called NewForms on a server called Reports. To start InfoPath and open a new form template with a department parameter that is equal to 10 and an organization parameter that is equal to 325, type the following:

"C:\Program Files\Microsoft Office\Office14\InfoPath.exe" \\Reports\NewForms\ExpenseReportTemplate.xsn /InputParameters department=10&organization=325

form template /InputParameters?param1=value&param2=value&param3=value

Opens a new form based on the form template that is published to a server running SharePoint, and then passes the parameters to the form. The form template must have managed code or script to process the parameters in the /InputParameters option. The name of the form template can be a file name, a fully qualified path and file name, or a URN.

The parameter list starts after the for template name with a question mark (?), followed by the name of the parameter, an equal sign (=), and the value of the parameter. Each parameter is separated by an ampersand (&). Do not use a space between the ampersand and each parameter.

A parameter name without a value is passed as a parameter with a null value, and a value without a corresponding parameter name is ignored.

For more information about writing managed code for input parameters, see the InfoPath developers reference.

Example    Imagine that you have a form template, ExpenseReportTemplate.xsn, with managed code that can process two input parameters called department and organization. The form template was published to a server running SharePoint with the URL http://fabrikam. To start InfoPath and open a new form template with a department parameter that is equal to 10 and an organization parameter that is equal to 325, type the following:

"C:\Program Files\Microsoft Office\Office14\InfoPath.exe" http://fabrikam/ExpenseReportTemplate.xsn?department=10&organization=325

/new form /defaultsavelocation <URL>

The /new option opens the existing form and the /defaultsavelocation option sets the path for the Save As dialog box to the specified Uniform Resource Locator (URL). The URL will appear in the Save As dialog box the first time that the form is saved.

Example    To start InfoPath, open the form MyForm.xml, and set the path where the user can save the form to C:\MyForms, type the following:

"C:\Program Files\Microsoft Office\Office14\infopath.exe" /new MyForm.xml /defaultsavelocation C:\MyForms

form template /defaultsavelocation <URL>

Opens a new form based on the form template and sets the path for the Save As dialog box to the specified URL. The URL will appear in the Save As dialog box the first time that the form is saved.

Example    To start InfoPath, open a new form based on the form template ExpenseReportTemplate.xsn, and then set the path where you want the user to save the form to the Windows SharePoint Services document library http://fabrikam/sites/Reports, type the following:

"C:\Program Files\Microsoft Office\Office14\ExpenseReportTemplate.xsn" /defaultsavelocation http://fabrikam/sites/Reports

/aggregate "form1|form2|form3" "form template"

Merges the forms in the form list into a single form based on a form template (.xsn). Individual form names in the form list should not be enclosed in quotations. An entire form list can be enclosed in quotations. The form names must be separated by a "|" (pipe) character. The form template used to perform the merge must also be specified. The merge begins by using the default data for the form template.

Example     You want to merge the forms MyForm1.xml and MyForm2.xml into a new form that is based on the form template ExpenseReportTemplate.xsn. The new form template is saved on your computer in the Forms folder. To start InfoPath and merge the two existing forms, type the following:

C:\program files\Microsoft Office\Office14\infopath.exe /aggregate "form1.xml" | "form2.xml" " formtemplate.xsn"

/design form template

Opens the specified form template in design mode. If no form template is specified, InfoPath starts in design mode without a form template.

Example    To start InfoPath in design mode with the form template ExpenseReportTemplate.xsn, type the following:

"C:\Program Files\Microsoft Office\Office14\infopath.exe" /design ExpenseReportTemplate.xsn

/design form template /forcesaveas

Opens the specified form template in design mode. You can make changes to the form template, but you must save the form template to a location other than where you opened the form template.

Tip: Use this option to open and modify an existing form template that has been published. This switch can help prevent you from accidentally overwriting the form template in the publish location by requiring you to save the form template to another location. If you overwrite a published form template by saving the form template at the publish location rather than by using the Publishing Wizard, users may not be able to create a new form or modify existing forms that are based on this form template. After you save the form template to another location and then modify the form template, you can use the Publishing Wizard to publish and overwrite the form template at the publish location.

Example    To start InfoPath in design mode with the form template ExpenseReportTemplate.xsn, and to help ensure that you will not overwrite the form template at the original location, type the following:

"C:\Program Files\Microsoft Office\Office14\infopath.exe" /design ExpenseReportTemplate.xsn /forcesaveas

/design form template /readonly

Opens the specified form template in design mode. You can make changes to the form template, but you must save the form template to a location other than where you opened the form template.

Tip: Use this option to open and modify an existing form template that has been published. This switch can help prevent you from accidentally overwriting the form template in the publish location by requiring you to save the form template to another location. If you overwrite a published form template by saving the form template at the publish location rather than by using the Publishing Wizard, users may not be able to create a new form or modify existing forms that are based on this form template. After you save the form template to another location and then modify the form template, you can use the Publishing Wizard to publish and overwrite the form template at the publish location.

Example    To start InfoPath in design mode with the form template ExpenseReportTemplate.xsn, and to help ensure that you will not overwrite the form template at the original location, type the following:

"C:\Program Files\Microsoft Office\Office14\infopath.exe" /design ExpenseReportTemplate.xsn /readonly

/embedding

Starts InfoPath without displaying the Microsoft Office InfoPath window. Developers use this option when testing custom applications with InfoPath.

Example    To do this, type the following:

C:\Program Files\Microsoft Office\Office14\infopath.exe" /embedding

/cache ClearAll

Starts InfoPath and clears the cache in which form templates are stored on the computer. Use this option to remove unused form templates from your users' computers and to increase available disk drive space. You can use this option with an existing form or a new form that is based on the form template.

Example    To start InfoPath, open the form MyForm.xml, and then clear the cache of all form templates, type the following

"C:\Program Files\Microsoft Office\Office14\infopath.exe" MyForm.xml /cache ClearAll

Top of Page

1 comment:

  1. Microsoft Office Tutorials: Command-Line Switches For Infopath >>>>> Download Now

    >>>>> Download Full

    Microsoft Office Tutorials: Command-Line Switches For Infopath >>>>> Download LINK

    >>>>> Download Now

    Microsoft Office Tutorials: Command-Line Switches For Infopath >>>>> Download Full

    >>>>> Download LINK k7

    ReplyDelete