0

I am using one list and it has one person field configured for "All Users".

So when i type some email ID in that person field, it is getting user and it works well.

But when i wants to add new record through client object model, some users are not available in UserinformationList in c# and Javascript as well.

Here is the code which i am trying to get all users list.

 ClientContext clientContext1 = new ClientContext(SiteUrl);
 clientContext1.AuthenticationMode = ClientAuthenticationMode.Default;
 UserCollection usrdd = clientContext1.Web.SiteUsers;
 clientContext1.ExecuteQuery();
  • 1
    users are added to UserinformationList on their first login to site. so if user are never login, you cant find it in userinformationlist. – Rajesh Joshi Feb 2 '15 at 7:21
0

If you need to get a reference to user object (either an existing one, or one that is just being created), use the ensureUser method (source from this thread):

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

context.executeQueryAsync(function(){

 alert(theUser.get_title());

},
function(sender, args){

  alert(args.get_message());

});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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