GitHub Icon Image
GitHub

Register SharePoint Organization Assets Library

Summary

This sample script shows how to register a SharePoint document library as an organization assets library.

  • SPO Management Shell
  • PnP PowerShell
  • CLI for Microsoft 365
# URL of SharePoint document library
$libraryUrl = "https://contoso.sharepoint.com/sites/OrgAssets/Images"

# Type of Organization asset library - ImageDocumentLibrary or OfficeTemplateLibrary
$orgAssetType = "ImageDocumentLibrary"

# 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

# Register document library as an organization asset library
Add-SPOOrgAssetsLibrary -LibraryURL $libraryUrl -OrgAssetType $orgAssetType

# Disconnect SharePoint online connection
Disconnect-SPOService

Check out the SPO Management Shell to learn more at: Introduction SharePoint Online Management Shell | Microsoft Docs

# URL of SharePoint online document library
$libraryUrl = "https://contoso.sharepoint.com/sites/OrgAssets/CompanyLogos"

# Type of Organization assets library - ImageDocumentLibrary or OfficeTemplateLibrary
$orgAssetType = "ImageDocumentLibrary"

# 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

# Register a document library as an organization assets library
Add-PnPOrgAssetsLibrary -LibraryUrl $libraryUrl -OrgAssetType $orgAssetType

# Disconnect SharePoint online connection
Disconnect-PnPOnline

Check out the PnP PowerShell to learn more at: https://aka.ms/pnp/powershell

The way you login into PnP PowerShell has changed please read PnP Management Shell EntraID app is deleted : what should I do ?

# URL of SharePoint online document library
$libraryUrl = "https://contoso.sharepoint.com/sites/OrgAssets/CompanyLogos"

# Type of Organization asset library - ImageDocumentLibrary or OfficeTemplateLibrary
$orgAssetType = "ImageDocumentLibrary"

# Get Credentials to connect
$m365Status = m365 status
if ($m365Status -match "Logged Out") {
    m365 login
}

# Register a SharePoint document library as an organization asset library
m365 spo orgassetslibrary add --libraryUrl $libraryUrl --orgAssetType $orgAssetType

# Disconnect SharePoint online connection
m365 logout

Check out the CLI for Microsoft 365 to learn more at: https://aka.ms/cli-m365

Important changes coming to the way you login into CLI for Microsoft 365 (effective 9th September 2024) see Changes in PnP Management Shell registration in Microsoft 365

Source Credit

Samples first appeared on:

  • Create an Organization Assets Library in SharePoint Online
  • Register SharePoint Document Library as an Organization Assets Library 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.

Back to top Script Samples
Generated by DocFX with Material UI