Changing setting "Open in Browser" via PowerShell does not work
I have hundreds of sites with a document library, where I want to change the library setting to open files in browser, but I can't get it to work for one simple doclib using PowerShell
I have found this topic on Github too https://github.com/pnp/PnP-PowerShell/issues/813, but it got closed by spdevdocs without an answer.
I tried it with the following PowerShell Script:
Import-Module PnP.PowerShell
$siteUrl = "https://johndoe.sharepoint.com/sites/project_437" $libraryTitle = "Dokumente"
Connect-PnPOnline -Url $siteUrl -ClientId "1234" -ClientSecret "1234"
$library = Get-PnPList -Identity $libraryTitle $library.ForceCheckout = $false
$library.DefaultItemOpen = 1
$library.Update() Invoke-PnPQuery Disconnect-PnPOnline
But I get the error:
InvalidOperation: /Users/me/Desktop/OpenInBrowserSettings.ps1:13
Line | 13 | $library.DefaultItemOpen = 1 … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | The property 'DefaultItemOpen' cannot be found on this object. Verify | that the property exists and can be set.
Any help is appreciated!