question

vvchwork avatar image
0 Votes"
vvchwork asked ElsieLu-MSFT commented

MOSS 2019 EE: SPWOPIBinding does not work on new sites

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.

office-sharepoint-server-administration
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

My SharePoint EE 2019 Srver:
Major Minor Build Revision


16 0 10374 20000

0 Votes 0 ·

Hi @86336514 Are there any error messages on the UI or in the ULS log? Are there any differences between these two sites?

0 Votes 0 ·
vvchwork avatar image
1 Vote"
vvchwork answered ElsieLu-MSFT commented

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
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Glad to hear that the problem has been solved and thanks for sharing! :)

0 Votes 0 ·
vvchwork avatar image
0 Votes"
vvchwork answered vvchwork edited

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)

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.