SharePoint Online offers powerful web parts and features that enhance the visual appeal of your sites, including the ability to search for external images on the web while using web parts like Image, Hero, Image Gallery, Quick links, etc. While this feature can be valuable in various contexts, there are scenarios where organizations prefer to disable or hide the option to search for external images especially when they have created organization assets libraries in the SharePoint tenant.
In this blog post, we’ll explore how to hide/disable the “Web search” feature in SharePoint using SharePoint Online PowerShell, PnP PowerShell and CLI for Microsoft 365.
Using SharePoint Online PowerShell
Use below SharePoint Online PowerShell script to disable or enable external image “Web Search” feature in SharePoint Online tenant:
# SharePoint online admin center URL
$adminCenterUrl = Read-Host -Prompt "Enter your SharePoint admin center site URL (e.g https://contoso-admin.sharepoint.com/)"
# Connect to SharePoint online admin center
Connect-SPOService -Url $adminCenterUrl
# Disable external image "Web Search" feature in SharePoint
Set-SPOTenant -FilePickerExternalImageSearchEnabled $false
# Enable external image "Web Search" feature in SharePoint
# Set-SPOTenant -FilePickerExternalImageSearchEnabled $true
# Disconnect SharePoint online connection
Disconnect-SPOService
Using PnP PowerShell
You can use below PnP PowerShell script to hide/disable external image “Web Search” feature in SharePoint Online:
# SharePoint online admin center URL
$adminCenterUrl = Read-Host -Prompt "Enter your SharePoint admin center site URL (e.g https://contoso-admin.sharepoint.com/)"
# Connect to SharePoint online admin center
Connect-PnPOnline -Url $adminCenterUrl -Interactive
# Disable external image "Web Search" feature in SharePoint
Set-PnPTenant -FilePickerExternalImageSearchEnabled $false
# Enable external image "Web Search" feature in SharePoint
# Set-PnPTenant -FilePickerExternalImageSearchEnabled $true
# Disconnect SharePoint online connection
Disconnect-PnPOnline
Using CLI for Microsoft 365
Use below CLI for Microsoft 365 script to remove/disable external image “Web Search” feature in SharePoint Online tenant:
# Get Credentials to connect
$m365Status = m365 status
if ($m365Status -match "Logged Out") {
m365 login
}
# Disable external image "Web Search" feature in SharePoint
m365 spo tenant settings set --FilePickerExternalImageSearchEnabled false
# Enable external image "Web Search" feature in SharePoint
# m365 spo tenant settings set --FilePickerExternalImageSearchEnabled true
# Disconnect SharePoint online connection
m365 logout
Conclusion
Disabling or hiding the web search for external images in SharePoint Online is a strategic choice for organizations that prioritize content security, brand consistency and compliance. By following the methods outlined in this blog post, you can tailor your SharePoint environment to align with your organization’s policies and enhance the overall governance of your digital assets.
Learn more
- Register SharePoint Document Library as an Organization Assets Library using PowerShell
- Remove an Organization Assets Library from SharePoint Online using PowerShell
- Enable/Disable SharePoint Online List Comments using CLI for Microsoft 365
- Enable and Customize Global navigation in the SharePoint app bar
- SharePoint Online: Empty Recycle Bin using PnP PowerShell