User Avatar Lookup

Technologies Used

PHP, Node.js, bash


The BEST Recognition Team has an established SharePoint process for receiving, reviewing and approving nominations for recognition. It didn’t make sense to uproot that entire process and try to replicate it on the BEST homepage with WordPress, so the idea was to take an export of newly approved nominees from SharePoint and import it.


SharePoint offers a fairly straightforward way to get an RSS feed of any list data, and importing RSS feeds into WordPress as posts is simple with a plugin such as WP Pipes. The main challenge here was the fact that SharePoint’s user column type dynamically displayed the users avatar and other info in SharePoint but only exported their name via RSS.

I had played with a Node.js module for Active Directory in the past, so I knew it could be used here. Originally, I was expecting the raw picture data to be stored in the traditional AD field “thumbnailPhoto,” but this wasn’t the case. Avatars are now stored “in the cloud” as a result of the move to Office 365.

Thankfully, the avatar URLs have a consistent format and only require the user’s email address as a parameter. The node script looks up the user by name (provided by SharePoint), gets their email address, then returns the avatar URL.

The Node.js script is configured to run on command with cgi-node.


The PHP script reads each RSS feed line by line. When a name is found, it requests the avatar URL from the Node script and inserts it into the item. It also makes a few formatting adjustments.

All of this is triggered by a cron job, which runs a bash script to curl the feeds coming from SharePoint and process them.


Complete, in production.

About The Author

Kyle Anderson
I'm a media and IT professional and JavaScript developer who worked most recently as an Associate Broadcast IT Engineer (Tier II) for CNN in Atlanta. One of my life-long goals is to help bridge data divides - missing connections between software systems and data stores - promoting inter-system communication and automation. Many of the projects described here reflect this goal in some way or another.