1

I have written the below code for getting the display name from the PeoplePicker field on PreSaveAction() call in my custom list form in SP 2010.

I got the displaytetx attr: mydomain\name2 Now using this display name, how to get the email id, department etc from user profile? Something like, i can pass this as a param to some other API - CSOM / JSOM /SPServices which extracts the email id

          <script language="javascript" src="/project/AssetsLib/jquery-
           1.6.0.min.js" 
         type="text/javascript"></script>
         <script language="javascript" 
       src="/project/AssetsLib/SPUtility.js" type="text/javascript">
        </script>
             <script language="javascript" 
           src="/project/AssetsLib/jquery.SPServices-2014.01.min.js" 
          type="text/javascript">
        </script>
            <script language="javascript" type="text/javascript">
   // This function from SPServices gets all of the Query String 
            //parameters
          var myuserid = _spPageContextInfo.userId;
         var queryStringVals = $().SPServices.SPGetQueryString();

  var  whatDisplayName ="Reporting Manager Name";
    var pp2 = $().SPServices.SPFindPeoplePicker({  
        peoplePickerDisplayName: 
     whatDisplayName }).row.find("div[id='divEntityData']")
     .attr("displaytext");
    alert(  'the pp title ...' + pp);
0

This may help but I am using this code in a SP Online.

var strFieldName = "FieldName";  
var ppDiv= $("[id$='ClientPeoplePicker'][title='" + strFieldName + "']");  
var spPP = SPClientPeoplePicker.SPClientPeoplePickerDict[ppDiv[0].id];  
spPP.AddUnresolvedUserFromEditor(true);  
if (!spPP.HasInputError)   
           {  
             var userKeys = spPP.GetAllUserInfo();  
         var myUser = userKeys[0];  
           }  
alert(myUser.EntityData.SPUserID);  

Regards, Christophe

| improve this answer | |
  • 1
    i think,SPClientPeoplePicker doesn't exist in SP 2010.Its available for SP 2013 only. – userAZLogicApps Feb 5 '16 at 9:12
  • is there a way we can read the peoplepicker value using CSOM/JSOM? whats the API for that, any idea? – userAZLogicApps Feb 5 '16 at 9:18
  • myUser.EntityData.SPUserID in this statement "SPUserID" does not exist – Zakir HC Oct 9 '18 at 12:14

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.