plugin |
---|
add-to-gallery |
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
[!INCLUDE More about SPO Management Shell]
# 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
[!INCLUDE More about PnP PowerShell]
# 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 logout
[!INCLUDE More about CLI for Microsoft 365]
Samples first appeared on:
- Create an Organization Assets Library in SharePoint Online
- Remove an Organization Assets Library from SharePoint Online using PowerShell
Author(s) |
---|
Ganesh Sanap |
[!INCLUDE DISCLAIMER]