Use SharePoint Libraries to distribute Office Templates and Company images

Have you heard about “SharePoint Organization Asset Libraries” ?

This feature rolled-out in the end of 2019, allows you to define some SharePoint Document Libraries as organization assets sources. What kind of assets are we talking about ? It actually enables two kinds of features:

  • The most famous is the ability to suggest organization images in SharePoint WebParts configuration. For example, you can distribute cover images for SharePoint Page header, or organization logos to be used in Image webparts or QuickLinks webparts.
  • The less famous but even more useful in my opinion, is the ability to distribute your company Office documents templates, directly into your users Office clients

How does it work ?

This feature leverage the Office 365 CDN (Content Delivery Network) capabilities. A CDN is a mechanism that aims to improve considerably websites performances by providing assets the website requires (such as scripts or images) closer to the browsers requesting it.

There are actually 2 kinds of CDN in Microsoft 365: 

  • Private: The content published on the CDN requires an authentication from users accessing the content. 
  • Public: The content published on the CDN is anonymously accessible.

For SharePoint Org. assets libraries, the default CDN used is the private one, and there is actually no real reason to use the public CDN since your Office Templates and WebPart settings should only be accessible by logged-in users.

So we are basically going to publish several SharePoint Libraries to the Office 365 CDN: Our libraries are going to be identified as “Origins” for the CDN.

SharePoint set up

To host our assets, we will create a dedicated SharePoint modern Communication site, where we will create our libraries.

We can configure up to 30 organization assets libraries, but they need to be all on the same Site collection.

Either for Images or Office templates, you’ll have to create modern Documents Libraries (no need to search for the “old” Image library SharePoint application).

You can have several Office Template libraries. Each one will be represented by a folder in your Office clients. If a user doesn’t have access to a library, he will still be able to see the folder (as it is registered as an origins for the CDN) but won’t be able to see any template inside. From a functional perspective, I would rather create only one Office Template Library with company templates at the root and several folders for specific department templates. Then I will manage the visibility of the folder with SharePoint permissions.

You can, and you should, create multiple Org. Image libraries. Creating several libraries allows you to define multiple families of images, such as Cover Images, Company logos, Product images and so on, so your users can find easier what they are looking for.

Once your libraries are created, you can upload your Images and Office Templates.

All your Office Template must be upload with an “Office Template” format: 

  • potx for PowerPoint
  • dotx for Word
  • xltx for Excel

Set your SharePoint libraries as Organization Assets

To define your SharePoint Libraries as Organization asset libraries, you need to have at least the SharePoint Admin role.

The operation can only be done using SharePoint Online Management Shell PowerShell commands. If you don’t have the PowerShell module, you can install it via PowerShell gallery, with the following PowerShell command:

Install-Module -Name Microsoft.Online.SharePoint.PowerShell 

Or using the -scope parameter if you are not local admin of your computer

Install-Module -Name Microsoft.Online.SharePoint.PowerShell -Scope CurrentUser 

Now that we have the correct PowerShell module, we can connect to our SharePoint Online central admin. Execute the following command and log you in with your SharePoint Admin account. It requires the SharePoint Admin Center URL that looks like “https://<tenant_name>-admin.sharepoint.com

Connect-SPOService https://<tenant_name>-admin.sharepoint.com 

Then we will execute the Add-SPOOrgAssetsLibrary cmdlet. Here are the parameters :

  • LibraryUrl: Mandatory. The URL of your SharePoint Library to define as an Organization asset library
  • OrgAssetType: Can be either “ImageDocumentLibrary” (default), that defines your organization images asset libraries or “OfficeTemplateLibrary”, that defines your Office Template libraries.
  • ThumbnailUrl: Optional. The URL of the image used as a background image for your images library on the image picker in SharePoint webparts configuration.
  • CdnType: Can be either “Private” (default) or “Public”

 

We’ll first register our “Company Templates” library as our Office Template Library

Add-SPOOrgAssetsLibrary -LibraryUrl "https://<tenant_name>.sharepoint.com/sites/templates/Company%20Templates" -OrgAssetType OfficeTemplateLibrary
 

If it is the first time you add a SharePoint Online Organization Assets Library, PowerShell will warn you that you will enable the CDN capabilities at your SharePoint Online tenant level. You’ll have to agreed by entering “Y”. This confirmation is mandatory for each type of CDN: Private and Public.

Each time you will add a new SharePoint Organization Assets Library, Powershell will ask you to confirm that you are OK to publish the library as a CDN origin.

Let’s register 2 organization images libraries: “Office 365 Icons” and “Cover Images”

Add-SPOOrgAssetsLibrary -LibraryUrl "https://<tenant_name>.sharepoint.com/sites/templates/Cover%20Images" -OrgAssetType ImageDocumentLibrary -ThumbnailUrl "https://<tenant_name>.sharepoint.com/sites/templates/Cover%20Images/Cover1.png"
Add-SPOOrgAssetsLibrary -LibraryUrl "https://<tenant_name>.sharepoint.com/sites/templates/Office%20365%20Icons" -OrgAssetType ImageDocumentLibrary -ThumbnailUrl "https://<tenant_name>.sharepoint.com/sites/templates/Office%20365%20Icons/Office.png" 

We can now see our organization assets libraries by running the following command:

Get-SPOOrgAssetsLibrary 

And we can see our CDN Origins per type of CDN (private or public) by running the following commands:

Get-SPOTenantCdnOrigins -CdnType Private
Get-SPOTenantCdnOrigins -CdnType Public 

It can take up to 15 minutes to have your libraries configured as CDN origins, and you’ll also have a delay of few hours to see your Office templates library show up in your Office Clients. 

Once it is configured, your can add or remove your images or office templates directly in the SharePoint document library and it will take effect immediately in your webpart configuration and Office clients.

Remove organization assets libraries

You have to user PowerShell to remove your organization assets libraries.

First of all, you’ll need to be connected to the “SPOService” using the commands we have used earlier.

Then we’ll need to run the following command to remove the library:

Remove-SPOOrgAssetsLibrary -LibraryUrl "/Cover Images" 

Removing the organization asset library won’t remove the CDN Origin, so you might want to run the following command as well:

Remove-SPOTenantCdnOrigin -OriginUrl "COVER IMAGES" -CdnType private 

8 Replies to “Use SharePoint Libraries to distribute Office Templates and Company images”

  1. Great article. Did implement it for a customer.
    I am just wondering what are the Office client requirements on that ?
    Does it require M365 Apps ? Are MSI Office client supported ?

    Thanks

  2. Nice post, I was looking for it for a while!
    How do you need to wait to not see it anymore in the template list of office apps after the full removal ?
    My office apps keep trace of the structure and is it is marked as deleted folders.
    Any way to clean a local desktop cache ?

  3. Have you been able to see this on Office.com when you create a new Word doc?

    https://docs.microsoft.com/en-us/sharepoint/organization-assets-library

    Office templates. When a user selects to create a new Office file (from Office.com or the Word, Excel, or PowerPoint desktop app), the user can select the tab for your organization to see the templates. (To use this feature on Office.com, users need to be assigned a license to Office 365 E3 or E5.)

  4. Couple tips that I found out:
    1. You can’t have a space in your document library URL
    2. The powershell doesn’t work in .net core powershell. Use PS 5.1 (or whatever is current for 5)

Leave a Reply

Your email address will not be published. Required fields are marked *