JavaScript SharePoint People Picker

Yes.. JavaScript SharePoint People Picker… try saying that 3 times fast.

Anyway, I needed one for a form I was developing. It had to be client side, and it needed to work with SharePoint.

In SharePoint 2013, there’s already support for this:

But I need something for SharePoint 2010. I found several articles on manipulating the data in the people picker, but very little on creating a people picker. I continued to google, and my googling bore fruit:

Tanmay Shahane has a neat little bit of code that uses the EntityEditor.js to create a people picker – obviously you should be including jQuery into your page for Tanmay’s script to work. The complete post is here:

But if the link is broken or something, Tanmay’s code as follows:

function EntityEditorHandleCheckNameResult(result, ctx) {
    ULSGjk: ;
    EntityEditorCallback(result, ctx);
    //login name
    var loginName = $(“”).attr(“title”);
    //display name
    var displayName = $(“ div:first-child”).attr(“displaytext”);
//Your custom code can go here for populating rest of the fields in the form calling user profile through client object model

Paul Tavares has some interesting widgets for People picking and Uploading that look promising, but I have yet to try them out:

Multiple Lists and IE9.. it continues

So when last we left, I was frantically tearing what’s left of my hair out, attempting to debug what was going on with JavaScript and Flash and Internet Explorer to make them hate each other.
As It turns out, in my scripts, I hide my flash object when it is not being directly accessed by the user. (It’s mimicking an attachment popup, so why would I have it sitting in the middle of the page unless the user wanted to attach something anyway?) I was doing this using “display: none”.
Bad, bad, bad coder!
There is a browser quirk, where if the Flash object is not rendered (e.g. “display: block”), the browser doesn’t recognize the object.
I replace the “display: none” with the “left: -5000px” trick, and viola! Flash and JavaScript and IE are talking and everyone is happy again.

SharePoint Calendar Colors with JavaScript

Yes, there is a “codeless” way to do this using views and calendars, but you may want to use the JavaScript method to get more than just the standard colors that ship with SharePoint 2010.

How to add color coded categories to your calendars with JavaScript:


This solution uses Calculated Fields to display colors related to a particular category. The Category column MUST be a choice column – a lookup column will not work as look-up columns are NOT allowed in Calculated Field Column equations.

You must be able to add a Content Editor Web Part to the pages where the calendar will be viewed.

Part 1: Setting up the JavaScript:

  1. Copy the following script into a text file: