-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #655 from ganesh-sanap/spo-register-org-assets-lib…
…rary New Sample: Register SharePoint Organization Assets Library. Closes #653
- Loading branch information
Showing
3 changed files
with
178 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
--- | ||
plugin: add-to-gallery | ||
--- | ||
|
||
# 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](#tab/spoms-ps) | ||
|
||
```powershell | ||
# 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 | ||
``` | ||
|
||
[!INCLUDE [More about SPO Management Shell](../../docfx/includes/MORE-SPOMS.md)] | ||
|
||
# [PnP PowerShell](#tab/pnpps) | ||
|
||
```powershell | ||
# 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 | ||
``` | ||
|
||
[!INCLUDE [More about PnP PowerShell](../../docfx/includes/MORE-PNPPS.md)] | ||
|
||
# [CLI for Microsoft 365](#tab/cli-m365-ps) | ||
|
||
```powershell | ||
# 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 | ||
``` | ||
|
||
[!INCLUDE [More about CLI for Microsoft 365](../../docfx/includes/MORE-CLIM365.md)] | ||
|
||
*** | ||
|
||
## Source Credit | ||
|
||
Samples first appeared on: | ||
|
||
- [Create an Organization Assets Library in SharePoint Online](https://ganeshsanapblogs.wordpress.com/2024/01/30/create-an-organization-assets-library-in-sharepoint-online/) | ||
- [Register SharePoint Document Library as an Organization Assets Library using PowerShell](https://ganeshsanapblogs.wordpress.com/2024/02/03/register-sharepoint-document-library-as-an-organization-assets-library-using-powershell/) | ||
|
||
## Contributors | ||
|
||
| Author(s) | | ||
|-----------| | ||
| [Ganesh Sanap](https://ganeshsanapblogs.wordpress.com/) | | ||
|
||
[!INCLUDE [DISCLAIMER](../../docfx/includes/DISCLAIMER.md)] | ||
<img src="https://m365-visitor-stats.azurewebsites.net/script-samples/scripts/spo-register-org-assets-library" aria-hidden="true" /> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
79 changes: 79 additions & 0 deletions
79
scripts/spo-register-org-assets-library/assets/sample.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
[ | ||
{ | ||
"name": "spo-register-org-assets-library", | ||
"source": "pnp", | ||
"title": "Register SharePoint Organization Assets Library", | ||
"shortDescription": "This sample script shows how to register a SharePoint document library as an organization assets library.", | ||
"url": "https://pnp.github.io/script-samples/spo-register-org-assets-library/README.html", | ||
"longDescription": [], | ||
"creationDateTime": "2024-02-03", | ||
"updateDateTime": "2024-02-03", | ||
"products": [ | ||
"SharePoint" | ||
], | ||
"metadata": [ | ||
{ | ||
"key": "SPO-MANAGEMENT-SHELL", | ||
"value": "16.0.23508.0" | ||
}, | ||
{ | ||
"key": "PNP-POWERSHELL", | ||
"value": "2.3.0" | ||
}, | ||
{ | ||
"key": "CLI-FOR-MICROSOFT365", | ||
"value": "7.3.0" | ||
} | ||
], | ||
"categories": [ | ||
"Configure" | ||
], | ||
"tags": [ | ||
"modern", | ||
"SharePoint Online", | ||
"Connect-SPOService", | ||
"Add-SPOOrgAssetsLibrary", | ||
"Disconnect-SPOService", | ||
"m365 login", | ||
"m365 status", | ||
"m365 spo orgassetslibrary add", | ||
"m365 logout", | ||
"Connect-PnPOnline", | ||
"Add-PnPOrgAssetsLibrary", | ||
"Disconnect-PnPOnline" | ||
], | ||
"thumbnails": [ | ||
{ | ||
"type": "image", | ||
"order": 100, | ||
"url": "https://raw.githubusercontent.com/pnp/script-samples/main/scripts/spo-register-org-assets-library/assets/preview.png", | ||
"alt": "Preview image for script sample" | ||
} | ||
], | ||
"authors": [ | ||
{ | ||
"gitHubAccount": "ganesh-sanap", | ||
"company": "", | ||
"pictureUrl": "https://avatars.githubusercontent.com/u/25476310?v=4", | ||
"name": "Ganesh Sanap" | ||
} | ||
], | ||
"references": [ | ||
{ | ||
"name": "Introduction to the SharePoint Online Management Shell", | ||
"description": "Check out the SPO Management Shell documentation site to get started and for the reference to the cmdlets.", | ||
"url": "https://docs.microsoft.com/powershell/sharepoint/sharepoint-online/introduction-sharepoint-online-management-shell" | ||
}, | ||
{ | ||
"name": "Want to learn more about PnP PowerShell and the cmdlets", | ||
"description": "Check out the PnP PowerShell site to get started and for the reference to the cmdlets.", | ||
"url": "https://aka.ms/pnp/powershell" | ||
}, | ||
{ | ||
"name": "Want to learn more about CLI for Microsoft 365 and the commands", | ||
"description": "Check out the CLI for Microsoft 365 site to get started and for the reference to the commands.", | ||
"url": "https://aka.ms/cli-m365" | ||
} | ||
] | ||
} | ||
] |