Created
April 16, 2021 19:05
-
-
Save mirontoli/633d5e4a1064f75f6d4c2c33466c35d8 to your computer and use it in GitHub Desktop.
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
# This script creates organization assets libraries, organization wide and local ones (country specific) | |
# https://docs.microsoft.com/en-us/sharepoint/organization-assets-library | |
Connect-SPOService https://takana17-admin.sharepoint.com | |
# Check the status first | |
Get-SPOOrgAssetsLibrary | |
Get-SPOTenantCdnEnabled -CdnType Private | |
Get-SPOTenantCdnOrigins -CdnType Private | |
# Create a site that will host organization assets | |
Connect-PnPOnline https://takana17-admin.sharepoint.com -UseWebLogin | |
$url = "https://takana17.sharepoint.com/sites/branding3" | |
$owner = "admin@takana17.onmicrosoft.com" | |
$everyone = "everyone except external users" | |
# You only can have one site for organizational assets | |
# but up to 30 libraries | |
New-PnPSite -Type CommunicationSite -Owner $owner -Url $url -SiteDesign Blank -Title "Takana17 Branding" | |
Connect-PnPOnline -Url $url -UseWebLogin | |
# Organization wide Assets | |
New-PnPList -Title "assets" -Template DocumentLibrary | |
Set-PnPList -Identity "assets" -Title "Takana17 Assets" | |
Set-PnPList -Identity "assets" -BreakRoleInheritance -CopyRoleAssignments | |
Set-PnPListPermission -Identity "assets" -User $everyone -AddRole 'READ' | |
Add-SPOOrgAssetsLibrary -LibraryUrl "$url/assets" -OrgAssetType ImageDocumentLibrary | |
# Organization wide Office Template | |
New-PnPList -Title "templates" -Template DocumentLibrary | |
Set-PnPList -Identity "templates" -Title "Takana17 Templates" | |
Set-PnPList -Identity "templates" -BreakRoleInheritance -CopyRoleAssignments | |
Set-PnPListPermission -Identity "templates" -User $everyone -AddRole 'READ' | |
Add-SPOOrgAssetsLibrary -LibraryUrl "$url/templates" -OrgAssetType OfficeTemplateLibrary | |
# Swedish assets | |
New-PnPList -Title "se_assets" -Template DocumentLibrary | |
Set-PnPList -Identity "se_assets" -Title "Bilder Sverige" | |
Set-PnPList -Identity "se_assets" -BreakRoleInheritance -CopyRoleAssignments | |
Set-PnPListPermission -Identity "se_assets" -User $everyone -AddRole 'READ' | |
Add-SPOOrgAssetsLibrary -LibraryUrl "$url/se_assets" -OrgAssetType ImageDocumentLibrary | |
# Swedish Office Templates | |
New-PnPList -Title "se_templates" -Template DocumentLibrary | |
Set-PnPList -Identity "se_templates" -Title "Mallar Sverige" | |
Set-PnPList -Identity "se_templates" -BreakRoleInheritance -CopyRoleAssignments | |
Set-PnPListPermission -Identity "se_templates" -User $everyone -AddRole 'READ' | |
Add-SPOOrgAssetsLibrary -LibraryUrl "$url/se_templates" -OrgAssetType OfficeTemplateLibrary | |
# Chuvash assets | |
New-PnPList -Title "cv_assets" -Template DocumentLibrary | |
Set-PnPList -Identity "cv_assets" -Title "Чӑваш ӳкерчӗкӗсем" | |
Set-PnPList -Identity "cv_assets" -BreakRoleInheritance -CopyRoleAssignments | |
Set-PnPListPermission -Identity "cv_assets" -User $everyone -AddRole 'READ' | |
Add-SPOOrgAssetsLibrary -LibraryUrl "$url/cv_assets" -OrgAssetType ImageDocumentLibrary | |
# Chuvash Office Templates | |
New-PnPList -Title "cv_templates" -Template DocumentLibrary | |
Set-PnPList -Identity "cv_templates" -Title "Чӑваш шаблонӗсем" | |
Set-PnPList -Identity "cv_templates" -BreakRoleInheritance -CopyRoleAssignments | |
Set-PnPListPermission -Identity "cv_templates" -User $everyone -AddRole 'READ' | |
Add-SPOOrgAssetsLibrary -LibraryUrl "$url/cv_templates" -OrgAssetType OfficeTemplateLibrary | |
# Next, remove everyone from country specific libraries and add country wide groups | |
# TODO script | |
# Thumbnails are good for Assets | |
$url6 = "https://takana17.sharepoint.com/sites/branding/se_assets/svensk-flagga.png" | |
Set-SPOOrgAssetsLibrary -ThumbnailUrl $url6 -LibraryUrl $url4 | |
Set-SPOOrgAssetsLibrary -LibraryUrl $url5 -OrgAssetType OfficeTemplateLibrary |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment