You surely noticed the feature in SharePoint Online, that you can see other people that are on the same Sharepoint list or are previewing the same file. A nice feature to collaborate together but there can be reasons to disable these. For example for a internal job market site based on a SharePoint list.

Microsoft noticed that customer feedback and provided us finally with a solution in February 2025 via PowerShell. All you need to do is to install either the Microsoft.Online.SharePoint.PowerShell or the PnP-Online PowerShell-Modules and be a SharePoint Administrator in your microsoft 365 tenant. Then you can disable these features with a simple command.
SharePoint Online Management Shell
# Installing the PowerShell Module
Install-Module -Name Microsoft.Online.SharePoint.PowerShell -Scope CurrentUser
# Connecting to SharePoint Online with MFA enabled
Connect-SPOService -Url "https://timoewiak-admin.sharepoint.com"
# Disabling the HidePeopleWhoHaveListsOpen feature on site collection Demo
Set-SPOSite -Identity "https://timoewiak.sharepoint.com/sites/Demo" -HidePeopleWhoHaveListsOpen $true
# Disabling the HidePeoplePreviewingFiles feature on site collection Demo
Set-SPOSite -Identity "https://timoewiak.sharepoint.com/sites/Demo" -HidePeoplePreviewingFiles $true
PnP-Online
# Installing the PowerShell Module
Install-Module PnP.PowerShell -Scope CurrentUser -AllowPrerelease -SkipPublisherCheck
# Connecting to SharePoint Online with MFA enabled and your registered application
# https://pnp.github.io/powershell/articles/registerapplication.html
Connect-PnPOnline "https://timoewiak-admin.sharepoint.com" -Interactive -ClientId xxxxxxxx
# Disabling the HidePeopleWhoHaveListsOpen feature on site collection Demo
Set-PnPSite -Identity "https://timoewiak.sharepoint.com/sites/Demo" -HidePeopleWhoHaveListsOpen $true
# Disabling the HidePeoplePreviewingFiles feature on site collection Demo
Set-PnPSite -Identity "https://timoewiak.sharepoint.com/sites/Demo" -HidePeoplePreviewingFiles $true
The setting will be applied instantly and no longer show you the persons who are simultaneously active on a SharePoint list or previewing a file. If you want to redo your changes just use $false instead of $true in the commands and both functions are back to normal.
