javascript - 如何在 JSOM 中使用 ClientPeoplePicker

标签 javascript sharepoint sharepoint-2013

我正在创建一个 SharePoint 托管应用程序。我想利用<SharePoint:ClientPeoplePicker>控制,但我正在努力读取用户在我的 App.js 之一中输入的值功能。

这里突出显示了 Default.aspx 的部分代码:

<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
...
<asp:TableCell>
  <SharePoint:ClientPeoplePicker ID="PMPeoplePicker" runat="server" Required="true" PrincipalAccountType="User" AllowMultipleEntities="false" ValidationEnabled="true" />          
</asp:TableCell>
...

这是 App.js 的一部分我想从控件读取值的代码:

function getPM() {
  // This is obviously not working ...
  var pm = $("#PMPeoplePicker");
  return pm;
}

最佳答案

查看此 MSDN 操作方法:在 SharePoint 托管的应用程序中使用客户端人员选取器控件

http://msdn.microsoft.com/en-us/library/office/jj713593(v=office.15).aspx

以及微软提供的演示代码

https://code.msdn.microsoft.com/SharePoint-2013-Add-the-900e0742

关于javascript - 如何在 JSOM 中使用 ClientPeoplePicker,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26507157/

相关文章:

javascript - 在 Webkit 和 Edge(jQuery 和 vanillaJS)上滚动时出现抖动/闪烁的背景图像

javascript - 使用 d、MMM yyyy 格式验证 javascript 中的日期

css - 通过 CSS 的 Sharepoint 2013 Web 部件着色

list - 在 Sharepoint 中按代码更改 ListView 查找阈值

javascript - SharePoint 2013 在添加项目上运行 Javascript

node.js - 是否可以在 Node.js 中实现 SharePoint 2013 远程事件接收器?

javascript - 动态加载系列 HighCharts

javascript - String toLowerCase 和 Contains 在一条语句中

rest - 使用逻辑应用中的 HTTP 连接器连接到 Sharepoint

visual-studio-2012 - Visual Studio 2012 : can't connect to sharepoint site