Unable to disable office webapps for SharePoint Webapplication
-
20-10-2020 - |
Вопрос
I am trying to disable Office WebApps for one web application using below powershell:
How does one disable Office Web Apps for a given Site Collection or Web Application?
$webAppsFeatureId = $(Get-SPFeature -limit all | where {$_.displayname -eq "OfficeWebApps"}).Id
$singleSiteCollection = Get-SPSite -Identity http://servername:port
Disable-SPFeature $webAppsFeatureId -Url $singleSiteCollection.URL
But I am getting below error:
Disable-SPFeature : Cannot convert 'System.Object[]' to the type 'Microsoft.SharePoint.PowerShell.SPFeatureDefinitionPipeBind' required by parameter 'Identity'. Specified method is not supported. At line:1 char:19 + Disable-SPFeature $webAppsFeatureId -Url $singleSiteCollection.URL + ~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Disable-SPFeature], Parame terBindingException + FullyQualifiedErrorId : CannotConvertArgument,Microsoft.SharePoint.Power
Shell.SPCmdletDisableFeature
How to resolve that? or is there any other way to disable Office WebApps for particular web application?
Решение
Unfortunately you can't disable Office Web Apps on a web application. It's the farm that has exchanged trust with the Office Web Apps farm.
What you do instead is to enable a site collection feature called OpenInClient. By this you force documents to open in client applications (Word, Excel,...) without removing access to Office Web Apps. And (as always) there is a script for that operation:
Enable-SPFeature 8A4B8DE2-6FD8-41e9-923C-C7C3C00F8295 -url <SiteCollURL>
Or for all sites
Get-SPSite -limit ALL |foreach{ Enable-SPFeature 8A4B8DE2-6FD8-41e9-923C-C7C3C00F8295 -url $_.URL }
To adjust the binding so that smartphones won’t try to view PDFs in Word Web App (but other devices will continue to), enter the following command and then press Enter:
Get-SPWopiBinding -Action "MobileView" -Application "WordPDF" | Remove-SPWopiBinding -Confirm:$false
To remove the binding altogether so that PDFs open in the default PDF viewer on all devices, use the following:
Get-SPWOPIBinding –Application "WordPDF" | Remove-SPWOPIBinding -Confirm:$false
Reference: Control whether PDFs open in Word Web App or the default PDF reader