Javascript 如何在JSOM中使用ClientPeoplePicker
我正在创建SharePoint托管的应用程序。我想利用Javascript 如何在JSOM中使用ClientPeoplePicker,javascript,sharepoint,sharepoint-2013,Javascript,Sharepoint,Sharepoint 2013,我正在创建SharePoint托管的应用程序。我想利用控件,但我很难在我的App.js函数中读取用户输入的值 以下是Default.aspx代码的突出显示部分: <%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bc
控件,但我很难在我的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>
...
查看此MSDN如何:在SharePoint托管的应用程序中使用客户端人员选取器控件 和微软提供的演示代码
谢谢@Ken,这很有帮助。事实上,我自己也看到了这篇文章,它确实解决了我的问题,但是,由于
被initializePeoplePicker
方法取代,我发现很难解决控件上的验证问题(必填字段,输入的用户文本已解决,仅一个用户,不允许分组),正如我在所提供的示例中从纯
开始一样。你处理过验证吗?谢谢
function getPM() {
// This is obviously not working ...
var pm = $("#PMPeoplePicker");
return pm;
}