Font Package management via SharePoint REST APIs

The article explores Microsoft's recent introduction of the Brand Center within SharePoint Online, facilitating font customization for SharePoint sites. It highlights the availability of pre-installed font packages and the ability to create custom font packages using the Brand Center.

Microsoft recently introduced the Brand Center to SharePoint Online. With the help of Brand Center, users can apply various  fonts to SharePoint sites.

Currently, SharePoint Online offers 8 pre-installed font packages. Additionally, the new Brand Center enables the creation of custom font packages using personalized fonts.

In his informative article How to Create a SharePoint Brand Center , Joe Ferreira details the process of setting up a SharePoint Brand Center  and creating custom font packages.

For more details, check out the SharePoint documentation on the Brand center.

Rather than focusing on the User Interface, let’s explore the REST APIs provided by SharePoint for managing Font packages.

We must use two distinct endpoints for retrieving different types of font packages.

  1. Out-of -the-box (OOTB) font packages
  2. Custom font packages

OOTB Font Packages

Get List of OOTB Font Packages:

Below endpoint retrieves the list of available OOTB font packages from the site

https://<tenant>.sharepoint.com/sites/<sitename>/_api/OutOfBoxFontPackages
Method GET
Headers Accept:application/json;odata=verbose
Content-Type: application/json;odata=verbose

 

Get Single OOTB Font Package

Below endpoint retrieves the single font package available in the tenant based on the ID. Here are the list of OOTB font packages and their ID,

Microsoft default: Segoe UI 59148df6-fea6-4bed-9a1e-de7652b2feb2
Amasis Pro 1e7a7803-045d-44df-9c7a-d2f2f8562e5
Aptos-Aptos Serif 90dd08f6-bf97-4de3-9770-111ed7805896
Georgia Pro Condensed-Verdana Pro Condensed 49c76a89-3ba2-4260-a392-5db89f3c4497
Office: Aptos Display-Aptos 1f3033ac-9c04-42b3-96e3-61f41a097eca
Sitka Heading-Sitka Text 629bfb9b-8a82-48d4-980d-4ce3bee4b868
Verdana Pro-Georgia Pro 5f955493-db94-446f-93bf-2c7567861329
Walbaum-Trade Gothic Next 1ade2d81-8f4f-4c78-b14e-d1e10e88919e

 

https://<tenant>.sharepoint.com/sites/<sitename>/_api/OutOfBoxFontPackages/GetById(<font package id>)
Method GET
Headers Accept:application/json;odata=verbose
Content-Type: application/json;odata=verbose

Apply font package to the site collection

Below endpoint applies the selected OOTB font package to the Site Collection.

https://<tenant>.sharepoint.com/sites/<sitename>/_api/OutOfBoxFontPackages/GetById(<font package id>)/Apply
Method POST
Headers Accept:application/json;odata=verbose
Content-Type: application/json;odata=verbose

 

Custom Font Packages

Get List of custom Font Packages:

Below endpoint retrieves the list of available OOTB font packages from the site

https://<tenant>.sharepoint.com/sites/<sitename>/_api/FontPackages
Method GET
Headers Accept:application/json;odata=verbose
Content-Type: application/json;odata=verbose

 

Get Single custom Font Package

Below endpoint returns the details of the specified custom font package based on the id,

https://<tenant>.sharepoint.com/sites/<sitename>/_api/FontPackages/GetById(<font package id>)
Method GET
Headers Accept:application/json;odata=verbose
Content-Type: application/json;odata=verbose

Apply custo m font package to the site collection

Below endpoint applies the selected custom font package to the Site Collection.

https://<tenant>.sharepoint.com/sites/<sitename>/_api/FontPackages/GetById(<font package id>)/Apply
Method POST
Headers Accept:application/json;odata=verbose
Content-Type: application/json;odata=verbose

By using these endpoints, we can programmatically access the list of font packages and apply the new and OOTB fonts to the SharePoint sites.

 

Shantha Kumar
Shantha Kumar
Articles: 295

Leave a Reply

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