none
custom peoplepicker in sharepoint not allowing to add a person from Active diroctory

    Question

  • Adding on to this:

    I am able to add a person only if he/she is in any of the sharepoint group.It is throwing error when trying to add a person from Active directory who is not in Sharepoint Group. Do I miss anything in the properties to be set.


    --------------------------------
    Hi

    I am using a custom peoplepicker with which I am adding a person to the list column "People/Groups" during button click .

    But when i add certain users, it is throwing some error(only with certain users)

    "Invalid look-up value A look-up field contains invalid data. Please check the value and try again."



    I am making use of the code


    if (peDelApprover.ResolvedEntities.Count > 0)
                    {
                        SPFieldUserValueCollection values = new SPFieldUserValueCollection();
                        foreach (PickerEntity entity in peDelApprover.ResolvedEntities)
                        {
                            SPFieldUserValue fuv = new SPFieldUserValue(SPContext.Current.Web, Convert.ToInt16(entity.EntityData[PeopleEditorEntityDataKeys.UserId]), entity.Description);
                            values.Add(fuv);
                        }
                        item["Delivery Approver"] = values;
                    }

    Note:peDelApprover is the id of the people editor i am using.


    Adding on to this

    • Changed type Mike Walsh FIN Thursday, December 03, 2009 5:03 AM always use the question type so people get credit for their replies to you
    • Edited by Mike Walsh FIN Thursday, December 03, 2009 5:05 AM NEVER write that something is very urgent. Next time I'll delete posts with this in. If in a hurry don't use forums, ring MS Customer Support Services.
    Thursday, December 03, 2009 3:57 AM

Answers

  • Hi there.

    Have you tried using SPWeb.EnsureUser ?

    Regards,
    Magnus

    My blog: InsomniacGeek.com
    • Marked as answer by Chengyi Wu Thursday, December 10, 2009 2:12 AM
    Thursday, December 03, 2009 8:34 AM
  • Hi,

    SPWeb.Ensure user will not add the user to any SharePoint group and it will not give any permission to the user on the site. It just checks whether the user is a valid user of the web and adds the user if required by creating a SharePoint Id for the user . So please try adding SPWeb.EnsureUser and make sure that it runs under elevated privilages.

    Regards,
    Remya
    • Marked as answer by Chengyi Wu Thursday, December 10, 2009 2:12 AM
    Friday, December 04, 2009 8:16 AM

All replies

  • Hi there.

    Have you tried using SPWeb.EnsureUser ?

    Regards,
    Magnus

    My blog: InsomniacGeek.com
    • Marked as answer by Chengyi Wu Thursday, December 10, 2009 2:12 AM
    Thursday, December 03, 2009 8:34 AM
  • Actually I dont want to add the user to any of the sharepoint group.So i am not using SPWeb.EnsureUser.




    Can I add the user name to the list column(people/group) directly from AD.

    It is possible in default sharepoint  list rite? Then why is it not possible here.
     
    Thursday, December 03, 2009 9:42 AM
  • Hi,

    SPWeb.Ensure user will not add the user to any SharePoint group and it will not give any permission to the user on the site. It just checks whether the user is a valid user of the web and adds the user if required by creating a SharePoint Id for the user . So please try adding SPWeb.EnsureUser and make sure that it runs under elevated privilages.

    Regards,
    Remya
    • Marked as answer by Chengyi Wu Thursday, December 10, 2009 2:12 AM
    Friday, December 04, 2009 8:16 AM
  • Thanks for the reply.That was really helpful.

    Friday, December 04, 2009 8:48 AM
  • Hi

    Can you explain more on this?

    Where I need to use the web.ensureuser

    please let me know

    Friday, May 04, 2012 10:59 PM