我有两个不同的sharepoint 2013开发环境A& B.以下功能仅适用于A。
function SetAndResolvePeoplePicker(fieldName, userAccountName) {
// alert(userAccountName);
var _PeoplePicker = $("div[title='" + fieldName + "']");
var _PeoplePickerTopId = _PeoplePicker.attr('id');
var _PeoplePickerEditer = $("input[title='" + fieldName + "']");
userAccountName.split(";").forEach(function (part) {
if (part !== "" && part !== null) {
// alert(part);
//
_PeoplePickerEditer.val(part);
var _PeoplePickerOject = SPClientPeoplePicker.SPClientPeoplePickerDict[_PeoplePickerTopId];
_PeoplePickerOject.AddUnresolvedUserFromEditor(true);
}
});
}
此函数用于使用用户列表填充SharePoint客户端人员选择器。其中fieldName是title属性,userAccountName是Domain \ username半列分隔的列表。 问题出在
var _PeoplePickerEditer = $("input[title='" + fieldName + "']");
此选择器无法返回服务器B中部署的解决方案中的输入控件,但它在服务器A中正常工作。