Question

I have People or Group Field

Normally I retrieve value of fields as:

var fieldUsuario = ctx.CurrentItem.Notificar_x0020_a

But now I dont want text value, I debbug it and it have email in span as:

<span class="ms-entity-resolved" id="Notificar_x0020_a_084ffd45-b361-458e-b55f-c824ba8995ec_$ClientPeoplePicker_i:0#.f|membership|email@mydomain.com_ProcessedUser0_UserDisplay" title="User, SubName" style="max-width: 331px;">User, SubName</span>

As you can see it have: email@mydomain.com I want to retrieve this value. How can I achieve it? Regards

Était-ce utile?

La solution

You can use the following script to find Email Address of the People Picker Value. if we have field name "Manager" with People Picker type then:

var arrEmailID = [];
var fieldName = "Manager";
var _PeoplePicker = $("div[title='" + fieldName + "']");
var emailSpan = $(_PeoplePicker).find('.sp-peoplepicker-userSpan');
if(emailSpan.length > 0) {
        $(emailSpan).each(function (){
            var _sid = $(this).attr('sid');
            arrEmailID.push(_sid);
            alert(_sid.split("|")[2]);
        })
}
else {
       alert("null");
}
console.log(arrEmailID);

Reference: https://social.technet.microsoft.com/Forums/azure/en-US/5e244f77-106b-4d26-8d8e-a1b5514489ec/get-people-picker-valueemail-id-on-sharepoint-online-edit-form

Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top