1. Create a New WOPI Binding in SharePoint
Scenario/Problem: You need to create a new binding to associate a file name extension with an application within your SharePoint farm.
Solution: Use the New-SPWOPIBinding
cmdlet.
The New-SPWOPIBinding
cmdlet
creates a new binding to associate file types or applications with
SharePoint. Essentially, if you have an Office Web App server running,
you simply need to execute this cmdlet with the server name, as shown
in Listing 1.
Listing 1. Creating the WOPI Binding in SharePoint
New-SPWOPIBinding -ServerName "Office.mycompany.com"
This automatically associates the supported
file extensions and applications within SharePoint. The current
supported applications are Word, Excel, PowerPoint, and OneNote.
You can also use the -Application
parameter to bind a specific application, as shown in Listing 2. The valid parameter values are as follows:
• Excel
• OneNote
• PowerPoint
• Word
Listing 2. Creating the WOPI Binding for a Specific Application
New-SPWOPIBinding -ServerName "Office.mycompany.com" - Application "Word"
2. Review Current SharePoint WOPI Bindings
Scenario/Problem: You would like to see the WOPI bindings generated on your SharePoint farm.
Solution: Use the Get-SPWOPIBinding
cmdlet.
You can use the Get-SPWOPIBinding
cmdlet to retrieve a list of bindings that were created as a result of the New-SPWOPIBinding
cmdlet, explained in the previous section. You can use the cmdlet
without any parameters, or you can provide one or more of the following
parameters to narrow the list:
• Action
: String that specifies a specific action to return (such as view
or edit
)
• Application
: String that specifies a specific application to return (such as Excel
)
• Extension
: String that specifies a specific file extension to return (such as doc
or xls
)
• Server
: String that specifies a specific WOPI server to return
• WOPIZone
: String that specifies a specific zone to return
Tip
Use the Get-SPWOPIBinding
with specific parameters in conjunction with the Set-SPWOPIBinding
cmdlet to implement default actions as explained in the next section.
3. Configure the Default Action for an Application
Scenario/Problem: You need to configure the default action for an application.
Solution: Use the Set-SPWOPIBinding
cmdlet.
The Set-SPWOPIBinding
cmdlet is used to set the default action of applications. This is achieved by providing the -DefaultAction
switch parameter, along with a WOPIBinding
object via the -Identity
parameter.
Use the Get-SPWOPIBinding
cmdlet, explained in the previous section, to set a variable to a specific binding or pipe the results into the Set-SPWOPIBinding
cmdlet, as shown in Listing 3.
Listing 3. Configuring the Default Action for Excel Documents in SharePoint
Get-SPWOPIBinding -Action "View" -Application "Excel"
| Set-SPWOPIBinding -DefaultAction:$true