MOSS 2019 EE: SPWOPIBinding does not work on new sites

Виктор Чеботов 101 Reputation points
2021-07-21T05:36:57.087+00:00

STEPS
01 - I created a website: site01.com
02 - I made a binding to OOS: New-SPWOPIBinding -ServerName "oos19.com"
03 - Everything worked and the documents began to open. Editing works.
***** Three months have passed... *****
04 - I created a website: site02.com
05 - The open document Online item has appeared on the site, but it does not work.
06 - I deleted the binding: Remove-SPWOPIBinding -All:$true
07 - I made a binding to OOS: New-SPWOPIBinding -ServerName "oos19.com"
08 - ...... but it does not work.
09 - I have cleared the configuration cache
if ($null -eq (Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue)) { Add-PSSnapin "Microsoft.SharePoint.PowerShell" }
$arrServers = Get-SPServer | Where-Object { $.Role -ne "Invalid" } | Select-Object -ExpandProperty Address
Write-Host "This script will reset the SharePoint config cache on all farm servers:"
$arrServers | Foreach-Object { Write-Host $
}
Write-Host "Press enter to start."
Read-Host
Invoke-Command -ComputerName $arrServers -ScriptBlock {
try {
Write-Host "$env:COMPUTERNAME - Stopping timer service"
Stop-Service SPTimerV4
# 2016 \15.0\ 2019 \16.0\
$ConfigDbId = [Guid](Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\16.0\Secure\ConfigDB' -Name Id).Id #Path to the '15 hive' ConfigDB in the registry
$CacheFolder = Join-Path -Path ([Environment]::GetFolderPath("CommonApplicationData")) -ChildPath "Microsoft\SharePoint\Config\$ConfigDbId"
Write-Host "$env:COMPUTERNAME - Clearing cache folder $CacheFolder"
Get-ChildItem "$CacheFolder*" -Filter *.xml | Remove-Item
Write-Host "$env:COMPUTERNAME - Resetting cache ini file"
$CacheIni = Get-Item "$CacheFolder\Cache.ini"
Set-Content -Path $CacheIni -Value "1"
}
finally {
Write-Host "$env:COMPUTERNAME - Starting timer service"
Start-Service SPTimerV4
}
}
10 - I deleted the binding: Remove-SPWOPIBinding -All:$true
11 - I made a binding to OOS: New-SPWOPIBinding -ServerName "oos19.com"
12 - As a result, OOS works only on the first site. It does not work on sites created later.

Microsoft 365 and Office | SharePoint Server | For business
{count} votes

Accepted answer
  1. Виктор Чеботов 101 Reputation points
    2021-07-23T08:23:22.953+00:00

    UPD 02

    The solution to the problem turned out to be implicit. Office Online does not work with Windows authorization, only with Claims.
    STEP 01
    Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

    $WebAppURL = "http://sharepoint2019.crescent.com/"
    $accountid = "crescent\SPAdmin"

    Get the web application

    $WebApp = Get-SPWebApplication $WebAppURL

    convert classic mode authentication to claims based authentication sharepoint 2010

    $WebApp.UseClaimsAuthentication = $true
    $WebApp.Update()

    $account = (New-SPClaimsPrincipal -identity $accountid -identitytype 1).ToEncodedString()

    Crate FULL Access Web Application User Policy

    $ZonePolicies = $WebApp.ZonePolicies("Default")
    $Policy = $ZonePolicies.Add($account,"PSPolicy")
    $FullControl=$WebApp.PolicyRoles.GetSpecialRole("FullControl")
    $Policy.PolicyRoleBindings.Add($FullControl)
    $WebApp.Update()

    Migrate users from Classic to Claims

    $WebApp.MigrateUsers($true)
    $WebApp.ProvisionGlobally()

    STEP 02
    Convert-SPWebApplication -Identity "http://sharepoint2019.crescent.com/" -From Legacy -To Claims -RetainPermissions

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Виктор Чеботов 101 Reputation points
    2021-07-21T09:34:09.687+00:00

    UPD 01

    $Enabled=$true
    $SetClaimsBasedAuth = Get-SPWebApplication "site02.com"
    $SetClaimsBasedAuth.UseClaimsAuthentication = $Enabled;
    $SetClaimsBasedAuth.Update()

    After switching to Claims, it started working partially. The menu for creating documents has appeared. When trying to edit, there is still an error.

    WOPIFrame - Unhandled exception: System.NotSupportedException: Unsupported principal type 'WindowsPrincipal'. Ensure that Claims authentication mode is enabled. в Microsoft.SharePoint.IdentityModel.SPIdentityContext.Create(IPrincipal principal) в Microsoft.SharePoint.IdentityModel.SPIdentityContext.get_Current() в Microsoft.SharePoint.Utilities.SPWOPIHost.GetAccessToken(SPWeb web, Guid uniqueId, String proofKeyId, SPUrlZone zone, SPBasePermissions perms, Boolean hasEditLicense, String restriction, Int64& ttl) в Microsoft.SharePoint.Utilities.SPWOPIHost.GetAccessToken(SPFile file, String proofKeyId, SPUrlZone zone, String restriction, Int64& ttl) в Microsoft.SharePoint.Utilities.SPWOPIHost.GetWOPITargetInternalForDocAspx(HttpContext httpContext, SPWeb web, Object& spPrimeObject, SPWOPIAction& requestedAction, SPRegionalSettings spSettings, String restriction, String substituteAccessToken, Int64 substituteAccessTokenTtl, String& wopiAppUrl, String& wopiFavIconUrl, String& wopiBootstrapperUrl, String& wopiAccessToken, Int64& wopiAccessTokenTtl, String& errorMessageToDisplay, String& redirectUrl, String[]& allowedOrigins, String& ext, String& progId, String& appName, String& wopiSrcUrl, String baseUrl) в Microsoft.SharePoint.Utilities.SPWOPIHost.GetWOPITargetInternalEx(HttpContext httpContext, SPWeb web, Object& spPrimeObject, SPWOPIAction& requestedAction, SPRegionalSettings spSettings, String restriction, String substituteAccessToken, Int64 substituteAccessTokenTtl, String& wopiAppUrl, String& wopiFavIconUrl, String& wopiAccessToken, Int64& wopiAccessTokenTtl, String& errorMessageToDisplay, String& redirectUrl, String[]& allowedOrigins, String baseUrl) в Microsoft.SharePoint.ApplicationPages.WOPIFrameHelper.OnLoadHelper(WOPIFrame frame) в Microsoft.SharePoint.ApplicationPages.WOPIFrameHelper.OnLoad(WOPIFrame frame)

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.