[Client object model] Field People from AD RRS feed

  • Question

  • Hello,

    I'am with client object model and I try to fill this column :

    this an extract of my code

    var listUserInFoList = Gte users from the current ClientContext.Web.SiteUserInfoList

    listItem["ActionOwner"] = listUserInFoList[0];

    Question : Is it possible to add on column ActionOwner an other User from AD, who is not konwed a the site level ? Thank YOU !!!! Julien

    Monday, May 14, 2012 8:54 AM


  • You have to use the 'context.Web.EnsureUser' function to make sure the user can be accessed inside the web then you will be able to add the user in the column, for example 

    //User which you want to assign
    User user = context.Web.EnsureUser(UserId);
    //ListItem update
    item["ActionOwner"] = user;

    If the ClientContext is not able to access the User then you will not be able to add that user, it is same for AD or Not AD accounts.

    Please click "Propose As Answer" if this post solves your problem or "Vote As Helpful" if this post has been useful to you.

    • Edited by get2pallav Monday, May 14, 2012 10:18 AM
    • Marked as answer by Qiao Wei Saturday, May 26, 2012 5:54 AM
    Monday, May 14, 2012 10:17 AM