This project has moved and is read-only. For the latest updates, please go here.

SPFindPeoplePicker AutoFill Set & Get values from PeoplePicker

Jul 8, 2014 at 7:51 PM
Hi Marc and everyone else!

I've been struggling building a form that works across all browsers and devices in SharePoint and is has the auto fill capabilities for the people pickers. As soon as I get one working I'm pretty sure I can extrapolate the rest. Goal is on page load to find the current user and their manager and have it checked into separate people picker controls but allow the user to change the fields to another user if they need to.

I think all I need is some help in getting and setting the PP values and I'll be set. I may be going about this the wrong way all advise would be great!
<form id="lyncRequest" runat="server">
<label for="User">User:</label>
<nobr style="display:none">User</nobr>
<SharePoint:PeopleEditor id="spPeoplePickerUser" Name="User" PlaceButtonsUnderEntityEditor="True" MultiSelect ="False" runat="server" SelectionSet="User">

<label for="Manager">Manager:</label>
<nobr style="display:none">Manager</nobr>
<SharePoint:PeopleEditor id="spPeoplePickerManager" Name="Manager" PlaceButtonsUnderEntityEditor="True" MultiSelect ="False" runat="server" SelectionSet="User"/>

        peoplePickerDisplayName: "User",
        valueToSet: userID,
        checkNames: true
        peoplePickerDisplayName: "Manager",
        valueToSet: managerID,
        checkNames: true

// I found I can add the user names to the People Pickers this way but it does not check the names 
       var userpeoplepicker = $("tr [id*='User'] div[title='People Picker']");
       var managerpeoplepicker = $("tr [id*='Manager'] div[title='People Picker']");
Any and all assistance would be greatly appreciated.
Jul 8, 2014 at 9:52 PM
The $().SPServices.SPFindPeoplePicker function is built to work on a standard list form. Since you are creating your own form, all bets are off. You could clone the function, though, and adapt it to your needs.

Marked as answer by lionheart831 on 7/9/2014 at 7:19 AM
Jul 9, 2014 at 12:57 PM
Ok, Thanks Marc for the info! Can it be used in the newifs.aspx page after some InfoPath edits or only on the NewForm.aspx page?
Jul 9, 2014 at 2:58 PM
InfoPath generates totally different markup than standard list forms, so it won't work there, either.

Marked as answer by lionheart831 on 7/9/2014 at 7:19 AM
Jul 9, 2014 at 3:14 PM
Thanks for the response. Once again I wish SharePoint was a bit friendlier! lol. Thanks for all your efforts Marc! I guess I'll just pull the pieces together, just was hoping there'd be a 'prettier' way in doing it. If it wasn't for Mac's inability to function with InfoPath's user profile service connection this project would have been soo much simpler!