Remove SharePoint Organization Assets Library
This sample script shows how to remove a SharePoint document library from organization assets libraries.
Summary
This sample script shows how to remove a SharePoint document library from organization assets libraries.
# URL of SharePoint document library
$libraryUrl = "https://contoso.sharepoint.com/sites/OrgAssets/Images"
# 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
# Remove/unregister an organization asset library in SharePoint tenant
Remove-SPOOrgAssetsLibrary -LibraryUrl $libraryUrl
# Disconnect SharePoint online connection
Disconnect-SPOService# URL of SharePoint online document library
$libraryUrl = "https://contoso.sharepoint.com/sites/OrgAssets/CompanyLogos"
# 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
# Remove organization assets library from SharePoint Online
Remove-PnPOrgAssetsLibrary -LibraryUrl $libraryUrl
# Disconnect SharePoint online connection
Disconnect-PnPOnline# URL of SharePoint online document library
$libraryUrl = "https://contoso.sharepoint.com/sites/OrgAssets/CompanyLogos"
# Get Credentials to connect
$m365Status = m365 status
if ($m365Status -match "Logged Out") {
m365 login
}
# Unregister a SharePoint document library from organization assets libraries
m365 spo orgassetslibrary remove --libraryUrl $libraryUrl --force
# Disconnect SharePoint online connection
m365 logoutSource Credit
Samples first appeared on:
- Create an Organization Assets Library in SharePoint Online
- Remove an Organization Assets Library from SharePoint Online using PowerShell
Contributors
| Author(s) |
|---|
| Ganesh Sanap |
Disclaimer
THESE SAMPLES ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
Tool documentation & references
- Introduction to the SharePoint Online Management Shell
Check out the SPO Management Shell documentation site to get started and for the reference to the cmdlets.
- Want to learn more about PnP PowerShell and the cmdlets
Check out the PnP PowerShell site to get started and for the reference to the cmdlets.
- Want to learn more about CLI for Microsoft 365 and the commands
Check out the CLI for Microsoft 365 site to get started and for the reference to the commands.