Thursday, July 17, 2014

SharePoint Organization Chart with Presence

Here's a little script that - depending on your setup - will enable you to get presence icons on your Org Chart looking like this:

The Org Chart links to the users SharePoint profile page with a url like the below:
http://company.com/Person.aspx?accountname=DOMAIN\Username

In our company we all have an email address that looks like this:
username@company.com (for internal use only)

Our usernames has a fixed length, so using the scripts substr function I grap the username from the end of the url and adds the company email trail to it. It's no magic and the script is small.

You can find the script here. You'll need to modify these two variables:
   // Please modify these two variables to fit your company settings
   var companyEmail = "@yourcompany.com";
   var lenghtOfUsername = 8;

You will then need to add the script to the HTML Source portion of a Content Editor web part. Please refer to sections 11 to 16 on this blog post to see how you do that. Also note that the script refers to jQuery and SPService using external CDN's and it is highly recommended that you download these scripts and refer to them locally.