SharePoint Experts Blog

Org Chart tip: Improve performance with user profiles caching

Note: This article is actual for Org Chart version 2.2.11 – 2.2.24. Version 2.2.26 is switched to client side caching.

Version 2.2.11 and higher for SharePoint On-Premises provides ability to cache user profiles using server side API. Thus, you can write simple warmup PowerShell script for Org Chart. The API provides two methods:

  1. Plumsail.OrgChart.Caching.CacheManager.InitUserProfilesCache(string webUrl) – initializes cache for User Profiles data source.
  2. Plumsail.OrgChart.Caching.CacheManager.ClearUserProfilesCache(string webUrl) – clears cache for User Profiles data source.

Thus you can initialize or clear user profiles cache for Org Chart. Response time of Org Chart ususally is good, but if you deal with large structures or want to make response time even better you can utilize this approach. It works for User Profiles data source only.

I created two PowerShell scripts for you:

  1. InitUserProfilesCache.ps1
  2. ClearUserProfilesCache.ps1

Click on the links to download. You can schedule InitUserProfilesCache.ps1 to run periodically, for example once a day. Your Org Chart will be rendered faster. You also get some additional profit, the script warms up Org Chart services, so first time open response time will be also improved.

The only thing you need to do before running the scripts, replace $webUrl with your own SharePoint site URL. Specify the URL of SharePoint site where Org Chart is located or root site collection URL.

Note: Scripts has to be started on all Web Front End servers of your farm.

This is how InitUserProfilesCache.ps1 looks:

$webUrl = "http://yoursiteurl/";

[System.Reflection.Assembly]::LoadWithPartialName("Plumsail.OrgChart")
[Plumsail.OrgChart.Caching.CacheManager]::InitUserProfilesCache($webUrl);

This is how ClearUserProfilesCache.ps1 looks:

$webUrl = "http://yoursiteurl/";

[System.Reflection.Assembly]::LoadWithPartialName("Plumsail.OrgChart")
[Plumsail.OrgChart.Caching.CacheManager]::ClearUserProfilesCache($webUrl);

Posted in: Products