3

I've tried retrieving data from a multiple people picker field on a SharePoint 2013 form in numerous ways, the best I've done is getting the display name. If it all possible i'd like to retrieve the email as well as the display name.

Things I've tried:

  • SPServices (the object returned doesn't give me properties containing display name or e-mail)
  • SPUtility (gives me only display name)
  • Parse the data manually (haven't gotten this to work)
2

I think you are implementing in JS.

This return array object, see image below: pp tutorial

The code:

var getIDPeoplePicker=$("div[Title='Column Name of the people picker here']").id;
var ppobject = SPClientPeoplePicker.SPClientPeoplePickerDict[getIDPeoplePicker];
var usersobject = ppobject.GetAllUserInfo();
  usersobject.forEach(function (index) {
    usersobject[index].DisplayText;
    usersobject[index].EntityData.Email;
  });

with this code will get id of the PP, People Picker Object, All users in specific PP and loop All users.

but before of use code, check your people picker column correctly.

Hope this helps.

0

You have several options :

  1. Use the GetPickerControlValue function (provided by EntityEditor.js) with false for the last parameter that will return you a HTML code with all the details for the current people selected in the people picker (then you need to parse the result to get what you want)

    GetPickerControlValue("ctl00_m_g_6f6e45e8_898e_4139_8792_b08a56926671_ctl00_ctl05_ctl08_ctl00_ctl00_ctl04_ctl00_ctl00_UserField", false, false);

  2. If you want to use a web service to get more info about a 'people', then you have to use the <ExpandUserField>True</ExpandUserField> tag in the options (see here)

  3. I don't know exactly if it will suit to your needs, but you can also have a look at my Sharepoint JS library with the People ahead plugin.

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.