需要从SharePoint人员选择器中获取用户电子邮件并显示警报。我尝试了以下选项,但在“人员选择器”中添加了姓名后无法收到警报。
var supervisorPicker = SPClientPeoplePicker.SPClientPeoplePickerDict['Reportee_x0020_Of_f56eef23-35a8-4afe-8ffe-3cbf6993a7ad_$ClientPeoplePicker']
supervisorPicker.OnValueChangedClientScript = function (peoplePickerId, selectedUsersInf)
{
var supervisorEmail = supervisorPicker.GetAllUserInfo()[0].EntityData.Email
showAlert(supervisorEmail);
};
和
var sup = $().SPFindPeoplePicker({
peoplePickerDisplayName: "Reportee Of"
});
if(sup != undefined){
showAlert(sup.dictionaryEntries[0].Email);
}
我的showAlert函数是这样的:
function showAlert(email){
$.ajax({
url: "http://xxxxxxx/DataService.svc/jsonData/"+email
}).then(function(data) {
alert(data.CL);
});
}