CustomForm中的ClientPeoplePicker

Vis*_*hwa 6 c# asp.net sharepoint jscript sharepoint-2013

我有日历,并有一些客户字段,并通过自定义表单输入.由于自定义表单默认使用SharePoint:FormField for people picker; 我已使用以下内容包含ClientPeoplePicker

<SharePoint:ClientPeoplePicker Required="true" ValidationEnabled="true" ID="peoplepciker"  runat="server" AutoFillEnabled="True" VisibleSuggestions="3"  Rows="1" AllowMultipleEntities="false"  CssClass="ms-long ms-spellcheck-true" Height="85px" />
Run Code Online (Sandbox Code Playgroud)

有人可以建议我如何将这个peoplepicker的输出"链接"/绑定到日历列表中的字段?

我只使用SP_Designer2013和SharePoint客户端,并且无法访问任何其他形状/形式的后端/服务器.

任何帮助都非常感谢.

谢谢

Min*_*rok 3

我知道这对你来说可能已经太晚了,但我也在寻找这个问题的答案,并认为我会分享我的解决方案。

旧控制

在我的新表单中,我想用 ClientPeoplePicker 替换一个控件。

<SharePoint:FormField runat="server" id="ff2{$Pos}" ControlMode="New" FieldName="Person" __designer:bind="{ddwrt:DataBind('i',concat('ff2',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Person')}"/>
Run Code Online (Sandbox Code Playgroud)

新控制

新的 ClientPeoplePicker 只需要与我要替换的控件相同的 id 属性。

<SharePoint:ClientPeoplePicker runat="server" id="ff2{$Pos}" />
Run Code Online (Sandbox Code Playgroud)

编辑

我发现一个论坛列出了该控件的一些属性,并认为我会将它们发布给任何偶然发现这个问题的人。

http://social.msdn.microsoft.com/Forums/en-US/1bd323bf-a009-446b-aac5-e2b9ebde1a07/sharepoint-client-people-picker-allowing-multiple-entries

<SharePoint:ClientPeoplePicker
        Required="true"
        ValidationEnabled="true"
        ID="pplPickerSiteRequestor"
        UseLocalSuggestionCache="true"
        PrincipalAccountType="User"
        runat="server"
        VisibleSuggestions="3"
        Rows="1"
        AllowMultipleEntities="false"
        CssClass="ms-long ms-spellcheck-true user-block"
        ErrorMessage="*" 
/>

<asp:CustomValidator 
        ID="cvpplSiteRequestor" 
        runat="server" 
        ControlToValidate="pplPickerSiteRequestor" 
        ForeColor="Red" 
        ClientValidationFunction="CheckSiteRequestor" 
        ErrorMessage="User is a required field"
        ValidationGroup="SiteAccessForm"
        Text="*">
</asp:CustomValidator>


function CheckSiteRequestor(sender, args) {
    args.IsValid = false;
    var userCount = $("span.ms-entity-resolved").length; //Returns the userNames Count 

    if (userCount === 1) {
        args.IsValid = true;
    }
}
Run Code Online (Sandbox Code Playgroud)