SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Supposedly, SP.Web.ensureUser(user) works according to this MSDN link but I cannot seem to get it to work in my JS code.

While debugging, I can see that SP.Web exists and the user variable is populated with the user that I expect. However I get the following exception:

Object function (b,a){ULSdih:;SP.Web.initializeBase(this,[b,a])} has no method 'ensureUser' 

Watching SP.Web.ensureUser() fail.

share|improve this question
Hi! Can you provide some code example how you do invoke this? – Anatoly Mironov Jan 28 '13 at 16:14
up vote 4 down vote accepted

You will have to call the ensureUser method against a valid web object. The following code should work:

var context = SP.ClientContext.get_current();
var theUser = context.get_web().ensureUser("DEV\testowner");



function(sender, args){


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.