October 1, 2019

How to get Organization Asset Libraries in SharePoint Online using REST API

Organization Assets Library is a new feature introduced in Office 365 which is a tenant level object. Currently, Organization Assets Library can be created only through PowerShell commands.

I was developing custom SPFx web part to display a list of Organization Assets Libraries. As it was a custom SPFx web part, I was looking for approach like REST API calls to fetch the Organization Assets Libraries instead of CSOM. After a deep analysis, I came to know that we can use REST API call to get the Organization Assets Library with their properties.

Use below SharePoint REST API to get the Organization Assets Libraries for a tenant:


This API will return the collection of Organization Assets Objects. It will return below properties for organization asset objects as shown in below screenshot.
REST API call result schema

Here are few points about Organization Assets libraries and REST API those need to be noted:
  • This API is retrieving tenant-level objects (Microsoft.Online.SharePoint.TenantManagement.Office365Tenant). So, it will return results only for users who are assigned with "SharePoint Administrator" role in the Office 365 tenant. 
  • All the Organization Assets objects must be created in a single site collection only.
  • Once the object/library is created, it will take 24 hours to get the Organization Asset objects using the API . Here is the more details how this API works:
    • There is an Azure function, which gets triggered by a timer (once a day).
    • The function gets SharePoint metadata and extracts all valuable information into JSON object.
    • The function stores JSON in Azure blob.
    • SharePoint REST API Metadata uses JSON, saved by Azure function to show you the metadata info.
If you have any questions you can reach out our SharePoint Consulting team here.

No comments:

Post a Comment