用户在SharePoint People Picker中输入名称时如何调用函数

时间:2018-07-18 10:02:42

标签: jquery sharepoint spservices sharepoint-2016

需要从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);
    });
}

0 个答案:

没有答案