首页 > 代码库 > [SharePoint 2013] Set value for people editor with JSOM

[SharePoint 2013] Set value for people editor with JSOM

function PeoplePicker() {    this.context = null;    this.web = null;    this.currentUser = null;    this.parentTagId = null    this.SetParentTagId = function (id) {        this.parentTagId = id;    }    this.SetLoggedInUser = function () {        if (this.parentTagId != null) {            this.getWebUserData();        }    }    this.getWebUserData = http://www.mamicode.com/function () {"input[title=‘" + $(parentTagId).attr(‘title‘) + "‘]");            _ppe.val(value);            var _ppo = SPClientPeoplePicker.SPClientPeoplePickerDict[this.parentTagId];            _ppo.AddUnresolvedUserFromEditor(true);        }    }}function SetWebUserData() {    var pplPicker = new PeoplePicker();    var controlId = $(‘td.ms-formlabel:contains("field name")‘).siblings(‘td‘).find(‘div[title="field name"]‘).prop("id");    pplPicker.SetParentTagId(controlId);    pplPicker.SetLoggedInUser();}$(document).ready(function(){    ExecuteOrDelayUntilScriptLoaded(SetWebUserData, "sp.js");});

  

[SharePoint 2013] Set value for people editor with JSOM