• sharepoint 人员选择控件使用


      1,先引入 js

      <SharePoint:ScriptLink Name="clienttemplates.js" runat="server" LoadAfterUI="true" Localizable="false" />
    <SharePoint:ScriptLink Name="clientforms.js" runat="server" LoadAfterUI="true" Localizable="false" />
    <SharePoint:ScriptLink Name="clientpeoplepicker.js" runat="server" LoadAfterUI="true" Localizable="false" />
    <SharePoint:ScriptLink Name="autofill.js" runat="server" LoadAfterUI="true" Localizable="false" />
    <SharePoint:ScriptLink Name="sp.js" runat="server" LoadAfterUI="true" Localizable="false" />
    <SharePoint:ScriptLink Name="sp.runtime.js" runat="server" LoadAfterUI="true" Localizable="false" />
    <SharePoint:ScriptLink Name="sp.core.js" runat="server" LoadAfterUI="true" Localizable="false" />

    2,添加div标签

     <div id="peoplePickerCCDiv"></div>

    3,初始化   initializePeoplePicker(peoplePickerCCDiv)

    function initializePeoplePicker(peoplePickerElementId) {

        var schema = {};     schema['PrincipalAccountType'] = 'User,DL,SecGroup,SPGroup';     schema['SearchPrincipalSource'] = 15;     schema['ResolvePrincipalSource'] = 15;     schema['AllowMultipleValues'] = true;     schema['MaximumEntitySuggestions'] = 50;     schema['Width'] = '280px';     schema['Height'] = '55px';

        this.SPClientPeoplePicker_InitStandaloneControlWrapper(peoplePickerElementId, null, schema); }

    4,获取用户信息

    function getUserInfo() {
        var peoplePicker = this.SPClientPeoplePicker.SPClientPeoplePickerDict.peoplePickerDiv_TopSpan;
        var users = peoplePicker.GetAllUserInfo();
        var userInfo = '';
        if (users.length > 0) {
            for (var i = 0; i < users.length; i++) {
                var user = users[i];
                var aduser = user.Key;
                if (aduser.indexOf("|") >= 0) {
                    userInfo += aduser.substring(aduser.indexOf("|") + 1) + ";";
                }
                else {
                    userInfo += aduser + ";";
                }
            }
        }
        return userInfo;
    }

  • 相关阅读:
    Bookmarks_www2
    Linux系统各发行版镜像下载(持续更新)
    tiny-rtems-src
    rtems-os-source
    OpenRCT2-ext
    PAT甲级1004题解——并查集思想改
    PAT甲级1008水题飘过
    PAT甲级1007题解——贪心
    PAT甲级1006水题飘过
    PAT甲级1005水题飘过
  • 原文地址:https://www.cnblogs.com/tengfei8/p/6862657.html
Copyright © 2020-2023  润新知