我正在创建一个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;
}
答案 0 :(得分:1)
查看此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