Set login to people picker column

Hi All,
Is there a way to set a pepole picker column default value ofthe user whose sign in to the list? I had a code for 2010 but it doesn't work in 2013 anymore.
Thanks a lot in advance

Hi,
If you can use SharePoint Designer it would be very easy because all you would have to do to get
the current logged user is to use the "Created By" field in the list. This column automatically populates the individual who created the item so just place the value of Created by column to your custom column<o:p></o:p>
<o:p> </o:p><script
type="text/javascript">
$(document).ready(function() { <o:p></o:p>
$('div.ms-inputuserfield').text($().SPServices.SPGetCurrentUser({fieldName: "Title",debug: false}));<o:p></o:p>
</script><o:p></o:p>
Or you can set the default value to ME,
which allow user set "Current User"  as default value as shown in below image.<o:p></o:p>
Krishana Kumar http://www.mosstechnet-kk.com
Please mark the replies and Proposed as answer if they help and solve your issue

Similar Messages

  • People Picker column not displaying name in list view

    I have a strange thing going on in list views. If I create a default view with a people picker column, it does not show the name - it appears to be blank (like below);
    If I then alter the view and make the style "Shaded" the user name appears (like below);
    It also seems to be an issue when looking at a Workflow process or survey results..  Can anybody explain to me why this is happening and how to resolve the issue? 

    Hi,
    As I understand, the issue occurs to All task view in task list, assigned to column not showing while it could be filtered.
    I’d recommend you create a new view with needed column including assigned to column, and make it default.
    Here is a similar thread, please check if it helps:
    http://sharepoint.stackexchange.com/questions/87089/assigned-to-column-text-hidden-but-filterable
    Regards,
    Rebecca Tu
    TechNet Community Support

  • Loss of people picker column data during import/export of a list in SharePoint 2010

    Hi 
    Even we are facing the same issue. i a have meeting minutes(ootb) list, there are totally 100 items with multiple participant in Participant column, when i try to import export that list to some other site.
    participant column loosing the data, for all the items the data is empty. 
    any idea?
    guru

    If the other site is in another site collection then that is to be expected.
    User information is cached on each site collection as the user identity is referenced. That means that a user might have id #7 on one site and #8438 on another. The user lookup column references that ID value rather than holding full information on the user
    in each column they might be needed. To avoid using the wrong IDs when you move a site i suspect it just throws them out.
    If that's the case then you'll need to create your own export/import process, most probably with PowerShell.

  • Sharepoint 2013 Setting people picker with Jquery not working in IE8

    In a SharePoint 2013 list with a people picker column labeled Name the following code works great in IE9 and IE10, however in IE8 the script shows an undefined is null or not an object error message at spPeoplePicker.AddUnresolvedUserFromEditor(true);
    FYI using jquery min 1.10.2
    Any ideas on how to resolve the issue?
    <script type="text/javascript">
    $(document).ready(function () {
    var userid = _spPageContextInfo.userId;
    //alert(userid)
    function GetCurrentUser() {
    var requestUri = _spPageContextInfo.webAbsoluteUrl + "/_api/web/getuserbyid(" + userid + ")";
    var requestHeaders = { "accept" : "application/json;odata=verbose" };
    $.ajax({
    url : requestUri,
    contentType : "application/json;odata=verbose",
    headers : requestHeaders,
    success : onSuccess,
    error : onError
    function onSuccess(data, request){
    var userName = data.d.Title;
    //set following "field" as column to set in people picker
    SetUserFieldValue("Name",userName);
    function onError(error) {
    //alert(error);
    function SetUserFieldValue(fieldName, userName) {
    var controlName = fieldName;
    var peoplePickerDiv = $("[id$='ClientPeoplePicker'][title='" + controlName + "']");
    var peoplePickerEditor = peoplePickerDiv.find("[title='" + controlName + "']");
    var spPeoplePicker = SPClientPeoplePicker.SPClientPeoplePickerDict[peoplePickerDiv[0].id];
    //comment out this field if edit form needs to be read only
    peoplePickerEditor.val(userName);
    //comment out this field if edit form needs to be read only
    spPeoplePicker.AddUnresolvedUserFromEditor(true);
    //disable the field
    spPeoplePicker.SetEnabledState(false);
    //hide the delete/remove use image from the people picker
    $('.sp-peoplepicker-delImage').css('display','none');
    GetCurrentUser();
    </script>

    Hi David,
    Below is the complete code I have used to load the current user to the people picker in SharePoint 2013.
    $(document).ready(function(){
    SP.SOD.executeFunc('sp.js', 'SP.ClientContext', LoadCurrentUser);
    function LoadCurrentUser() {
    var context = SP.ClientContext.get_current();
    var siteColl = context.get_site();
    var web = siteColl.get_rootWeb();
    this._currentUser = web.get_currentUser();
    context.load(this._currentUser);
    context.executeQueryAsync(Function.createDelegate(this, SetPickersToCurrentUser), Function.createDelegate(this, LoadUserfailed));
    function LoadUserfailed() {
    alert('failed');
    function SetPickersToCurrentUser()
    var loginName = this._currentUser.get_title();
    SetPeoplePicker('Order Team', loginName);
    function SetPeoplePicker(fieldName, userAccountName) {
    var peoplePickerDiv = $("[id$='ClientPeoplePicker'][title='" + fieldName + "']");
    var peoplePickerEditor = peoplePickerDiv.find("[title='" + fieldName + "']");
    var spPeoplePicker = SPClientPeoplePicker.SPClientPeoplePickerDict[peoplePickerDiv[0].id];
    peoplePickerEditor.val(userAccountName);
    spPeoplePicker.AddUnresolvedUserFromEditor(true);
    Let me know if you have any questions. I will help you out!
    -Praveen.
    ASP.NET and SharePoint developer
    Blog: http://praveenbattula.blogspot.com
    Please click "Propose As Answer" if a post solves your problem or "Vote As Helpful" if a post has been useful to you.

  • How to create a people picker type metadata in a document set?

    
    Hi folks,
    I want to create a people picker type metadata in a document
    set (it has some content types and it resides inside a library).
    So please help me knowing steps for creating it. 
    Our web application is using classic based authentication therefore I want to retrieve the names and groups in people picker column from Active Directory.
    Also, the document set library for which I want to create people picker metadata did not had document set before and documents where saved directly in content types as well as the metadata that now we are making as people picker was before of type Single line
    of text. 
    So, whether after creating it of type people picker, at the time of moving documents into document set, it will create problem? If yes,than of of what kind and how can it be resolved?
    Replies will be greatly appreciated.
    -Ishita

    Hi,
    From your description, I know you want to add a people picker column in a document set, then add this document set into a document library.
    If you want to add a people picker column in a document set you should create a document set first. You can know how to create and configure a document set by referring to this article: https://support.office.com/en-us/article/Create-and-configure-a-new-Document-Set-content-type-9db6d6dc-c23a-4dcd-a359-3e4bbbc47fc1.
    After creating a document set, you can follow these steps below to add a people picker column in a document set: click Site Actions -> Site Settings -> under  Galleries section, Site content types -> find the content you want to add people
    picker column -> under Columns section, Add from new site column -> Name and Type, enter your column name and choice Person or Group -> OK.
    If you move documents into document set, it will keep the current properties. You can edit properties to change the document to another content type which is  contained in the document set.
    In my case, DocA is the content type of the document library, Document and DocB are content types of the document set.
    If I have mis-understand, please let me know.
    Best Regards

  • Can you add People Picker with multiple values to Word Document using Quick Parts?

    Hi all, I've been trying to develop a form in Word that takes a bunch of metadata from the SharePoint library. Most of it works okay, but when I try to add any fields that have been set up to take multiple entries in a people picker, they don't show up
    in the add quick parts list. Any ideas, or is this a limitation?

    Hi NREL,
    According to your description, my understanding is that the people picker column with multiple values was missing in Word Quick Parts.
    This is by design that we are unable to use the fields which is allowed multiple selections.
    As a workaround, you can use a text field(Single line of text) to store the multiple values of the people column. When you create a document, start a workflow to update the text field using the values of the people column, then use the
     text field in Word Quick Parts.
    You can do as the followings:
    Open your library, and create a new column using Single line of text.
    Open your site with SharePoint 2010 Designer, create a workflow based on your library.
    Add the action “Set Field in CurrenItem”, and set it like the screenshot.
    Set the Start Options is “Start workflow automatically when an item is created”.
    Best Regards,
    Wendy
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Wendy Li
    TechNet Community Support

  • How to populate a field in an Infopath form based on the people picker input - only OOTB approach

    Hello,
    I have 3 lists : Resource , Project, Contract
    In "Contract" list i have created a form with MS Infopath 2010. This form is used to collect data of a new resource joining a project . This form also takes the information about the resource's costs.
    Scenario :
    Project informations are already present in the "Project" list.
    Any new resource who will be joining a project will be added in the "Resource" list at first . This list has its own form to do so. While adding this resource the form asks for the project which should be assigned. This is dealt with.
    "Contract" list : In this lists form their is a people picker field where the resource email id(already inserted in "Resource" list earlier) will be typed by me. There is a field which will capture the project name.
    Issue in "Contract" list:
    When i type the resource email id and click on the people picker icon , the project field in the form should get auto populated with the corresponding project of the existing resource so that i donot have to type the project name again. This project info
    should be fetched from "Resource" list only.
    Please let me know how i can achieve this by OOTB approach .
    Regards,
    Guru

    try these links:
    http://sharepoint.stackexchange.com/questions/103682/autopopulate-form-fields-based-on-selection-in-people-picker-column-using-javasc
    http://sharepoint.stackexchange.com/questions/80261/people-picker-not-getting-populated-in-the-sharepoint-site
    http://blogs.technet.com/b/anneste/archive/2011/11/02/how-to-create-an-infopath-form-to-auto-populate-data-in-sharepoint-2010.aspx

  • How to save users added to list using people picker to sharepoint Group

    Hi
                I have created List with some people picker columns and now when I save a list,the data is saved to list as well as the users in particular column will be added to particular sharepoint
    group. Is there any sharepoint out of box solution for this or I need to do it programmatically. Kindly provide me any procedures or solutions as you know.
      1) how to bind the particular sharepoint group to the particular column
      2) How to add users to the particular sharepoint group
    Thanks
    Razvi444

    Hi Razvi444,
    There is no out of the box way to achieve this.You need to write a custom event receiver ,inside event receiver
    event,  you
    can check column (people picker value) and add it to desired group if that user not exist already.
    Thanks

  • Created By field and Modified By field and People Picker field values are hidden to other Users

    Hi,
    We have a strange permission issue in one of the MOSS-2007 server farm. The users are not able to see each other name in "created by" and "modified by" column value in lists and libraries. For example if "User A" create an item in a list then if "User B" opens that item then he cannot see "created by" and "modified by" column value and vice-versa. But they can see their name in "created by" and "modified by" column but not others. Both the users has contribute access to that list, so both can edit each other data but cannot see each other name.
    This become a bigger issue, if any of tje list has people picker column, then thay cannot see that column value(if that column value does not his/her own name). This means this column value will be always empty for "user A" when that peopel picker value is anything other than "User A". This happens for all the lists and libraries. 
    Even "User A" and "User B" are owner of that site, it behaves the same. But site collection administrator can see  "created by" and "modified by" for all items for all the users.
    It seems very strange for me. any help on this will be appreciated.
    Thanks in advance,
    Sanban

    Hi,
    You can try to create a new standard view, then select “created by” and “modified by” column under columns, next apply this view, finally check the effect.
    Did you customize the permissions of the list or document library? Did you customize the permission of the item? For example, break the permission inheritance form its parents. If so, try to inherit permission from its parents, after that create a new standard view according to the steps above, then check the effect.
    By default, permissions on lists, libraries, folders, items, and documents are inherited from the parent site. However, you can break this inheritance for any securable object at a lower level in the hierarchy by editing the permissions on that securable object (that is, creating a unique permission assignment) . For example, you can edit the permissions for a document library, which breaks the permissions inheritance from the site.
    You can also try to create a new document library, then create a new document with user A, after that log into with user B, check the effect.
    For more information about  SharePoint : page level permissions, please refer to the following article:
    SharePoint : page level permissions
    http://blogs.msdn.com/brettrobinson/archive/2009/04/24/sharepoint-page-level-permissions.aspx
    For more information about control access to sites, please look into the following articles:
    About controlling access to sites and site content
    http://office.microsoft.com/en-us/sharepointtechnology/HA101001441033.aspx
    Permission levels and permissions
    http://office.microsoft.com/en-us/sharepointtechnology/HA101001491033.aspx
    For more information about how to create a view, please refer to the following article:
    Create or change a view
    http://office.microsoft.com/en-us/help/HA100215771033.aspx
    Hope this helps.
    Rock Wang
    Rock Wang– MSFT

  • Update the people picker URL

    I have create the view which include the People picker column(name) and single line text column.
    I created the default view for the list.
    On clicking Name , It is navigating to the Myid portal.
    But i need to navigate to the current item display form . 
    Please help me on this. 

    Hi,
    From your description, my understand is that you want to redirect
    People picker column to display form instead of userid portal.
    You could accomplish your requirement with SharePoint Designer. Please try these steps below:
    1.    
    Open the view in design model you have created with SharePoint Designer.
    2.      
    Right click the People Picker column, and choose: Format Item as -> Hyperlink to -> Display Form, as the screenshot below.
    3.      
    Open the view in Split model, please replace the code “<xsl:value-of disable-output-escaping="yes" select="$thisNode/@*[name()=current()/@Name]" />” with code “<xsl:value-of select="substring-before(substring-after(substring-after(substring-after(substring-after(substring-after($thisNode/@*[name()=current()/@Name],
    '&gt;'),'&gt;'),'&gt;'),'&gt;'),'&gt;'),'&lt;')" disable-output-escaping="no"/>” as the screenshot below.
    Best Regards,
    Vincent Han
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Set Default Value for People Picker in List Template current user

    Hi,
    I have field definition in my custom list
      <Field ID="{26763808-64BB-4A3C-93A0-ED45AF783D45}"  Type="User" Name="RequestedBy" DisplayName="Requested By" Required="FALSE" ></Field>
    I need to set default current user in this.
    I found few options with javascript.
    Thanks in Advance.
    Where I can find on set of default commands like Today
    Hari

    Hi,
    Default current user can’t be got in calculated column like Today. I suggest that use SPD Workflow described above or JavaScript. Open NewForm page of the list, then add “pageview=shared&toolpaneview=2”
    to the page URL, click Enter to go to edit mode. Then add a Content Editor Web Part to the bottom of NewForm page, copy the code bellow into Source Editor of CEWP.   
    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
    <script type="text/javascript" src="http://come:100/sites/collection1/Shared Documents/jquery.SPServices-0.7.0.js"></script>
    <script type="text/javascript">    
    $(document).ready(function(){
    var CurrUser=$().SPServices.SPGetCurrentUser({
    fieldName: "Name", debug: false});
    $('#ctl00_m_g_dab5800a_09ac_4f35_97f6_9b5496127f68_ctl00_ctl04_ctl02_ctl00_ctl00_ctl04_ctl00_ctl00_UserField_upLevelDiv').html(CurrUser);
    </script>
    Note:
    download jquery.SPServices-0.7.0.js here and upload it to your own site:
    http://spservices.codeplex.com/SourceControl/list/changesets, and then replace the route of jquery.SPServices-0.7.0.js above with the route in your site. ctl00_m_g_dab5800a_09ac_4f35_97f6_9b5496127f68_ctl00_ctl04_ctl02_ctl00_ctl00_ctl04_ctl00_ctl00_UserField_upLevelDiv
    is the id of the people-picker, please find it in your own NewForm page.
    Another method, you can use Event Handler. Here is the example code.
    public
    override void ItemAdded(SPItemEventProperties properties)
    if (properties.ListTitle == "listname")//replace listname with your list.
    SPWebcurrentWeb = properties.OpenWeb();
    SPUseruser = currentWeb.SiteUsers.GetByID(properties.CurrentUserId);
    SPListItemliitem = properties.ListItem;
    SPFieldUserValuefieldUser =
    newSPFieldUserValue(currentWeb, user.ID, user.LoginName);
          liitem["currentuser"] = fieldUser;//replace currentuser with your field name.    
          liitem.Update();
    //base.ItemAdded(properties);
    If anything unclear, please feel free to ask.
    Thanks.
    Emir Liu
    TechNet Community Support

  • Restricting People Picker of "Person or Group" column to Site Groups only

    Hi,
    I am working on SharePoint Online 2013 and I have created a column - DocOwner with "Person or Group" type in document library. In the site collection there are 4 groups lets say - A,B,C,D. When user creates a new item (document set), in newform.aspx,
    I want to restrict the people picker of "Docowner" column to only Site groups, as currently it is showing all users who are there in SharePoint online.
    I read this article - http://office.microsoft.com/en-in/sharepoint-server-help/site-column-types-and-options-HA010302196.aspx#_Toc277149829.........where they are saying that we can limit the people picker to site users only.
    How this can be achieved using OOTB in SharePoint 2013 Online ? 
    Vipul Jain

    You can create a workflow to execute CSOM which will verify group membership details and update it to choice column 
    http://stackoverflow.com/questions/23432665/sharepoint-online-csom-associated-site-groups-associatedmembergroup-associatedow
    http://sundarnarasiman.net/?p=497
    namespace GetUsersInGroupCSOM
    class Program
    static void Main(string[] args)
    //Replace it with the url of your tenant or your site-collection
    string SiteUrl = "https://yoursite.sharepoint.com";
    System.Uri oUri = new System.Uri(SiteUrl);
    using (ClientContext oClientContext = new ClientContext(SiteUrl))
    //Replace it with your user id for SharePoint Online
    string UserName = "[email protected]";
    //Replace it with your password
    string Password = "yourpassword";
    //Create a SecureString object from password string, needed for SharePointOnlineCredentials class
    SecureString SecurePassword = GetSecureString(Password);
    oClientContext.Credentials = new SharePointOnlineCredentials(UserName, SecurePassword);
    //Load the site-collection groups using CSOM
    oClientContext.Load(oClientContext.Web.SiteGroups);
    oClientContext.ExecuteQuery();
    GroupCollection oSiteCollectionGroups= oClientContext.Web.SiteGroups;
    Console.WriteLine("List of groups in the site collection");
    Console.WriteLine("-------------------------------------");
    foreach (Group oGroup in oSiteCollectionGroups)
    Console.WriteLine(oGroup.Title);
    Console.WriteLine("\n");
    //Load the users collection in the Group 1
    oClientContext.Load(oSiteCollectionGroups[1].Users);
    oClientContext.ExecuteQuery();
    Console.WriteLine("List of users in the first group of site-collection");
    Console.WriteLine("-------------------------------------");
    foreach(User oUser in oSiteCollectionGroups[1].Users)
    Console.WriteLine(oUser.Title);
    Console.WriteLine("\n");
    Console.ReadLine();
    private static SecureString GetSecureString(String Password)
    SecureString oSecurePassword = new SecureString();
    foreach (Char c in Password.ToCharArray())
    oSecurePassword.AppendChar(c);
    return oSecurePassword;
    http://the-north.com/sharepoint/post/Update-Choice-Field-using-CSOM-%28Client-side-Object-Model%29
    using (ClientContext
    ctx = new ClientContext("http://MyServer/MySite"))
    Field genericField = ctx.Web.Lists.GetById(listID).Fields.GetById(fieldGuid);
    FieldChoice fldChoice = ctx.CastTo<FieldChoice>(genericField);
                    ctx.Load(genericField);
                    fldChoice.Choices = “MyChoice1;MyChoice2;MyChoice3”.Split(";".ToCharArray());
                    fldChoice.Update();
                    ctx.ExecuteQuery();               
    If this helped you resolve your issue, please mark it Answered

  • When add a people picker (user column) in Word document (Template) and try to add a name it stuck!

    When add a people picker (user column) in Word document (un the document Template) and try to add a name it stuck!
    Is it a known issue?
    keren tsur

    Hi,
    According to your description, I have tested in my environment and I  have the same behavior.
    Only if you type the wrong name in the first time, then you click the phone book to search the right name and save, it will stuck. It means if you do other operation(e.g. type the wrong name then click “resolve” button, then search in the phone book) and
    repeat the operation above, it won’t stuck.
    It is appreciate that you can submit a feedback to Microsoft:
    https://connect.microsoft.com/
    Thanks,
    Dean Wang
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • MOSS 2007 - Sort People Picker by Display Name, Not Login

    I've been looking for a way to sort the people picker based on the user's Display Name. I've found some great articles on setting the People Picker scope (thanks, by the way), but nothing about the sorting. Any point in the right direction would be greatly appreciated.
    TIA
    John.

    Hi Ridz,
    Thanks for posting your query, Kindly find out the code snippet that you can use for your issue
    PeopleQueryControl using SPUtility.SortPrincipalInfo() method:
    private static IList SortPrincipalInfo(IEnumerable principals)
    SortedList list = new SortedList();
    foreach (SPPrincipalInfo info in principals)
    string str = info.LoginName.ToLowerInvariant();
    string key = string.Concat(new object[] { info.DisplayName, " ", str, info.IsSharePointGroup });
    if (!list.ContainsKey(key))
    list.Add(key, info);
    return list.Values;
    PeoplePicker sorts results by display name.
    I hope this is helpful to you, mark it as Helpful.
    If this works, Please mark it as Answered.
    Regards,
    Dharmendra Singh (MCPD-EA | MCTS)
    Blog : http://sharepoint-community.net/profile/DharmendraSingh

  • Set default value for people picker only when user checks a checkbox (Sharepoint 2010)

    The javescript in below link works for me.
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/2b130f64-3db2-484a-9a53-ccbe18d2c5de/set-default-value-for-people-picker-in-list-template-current-user?forum=sharepointgenerallegacy
    However, I'd like to set default user for people picker only when user checks a checkbox. 
    I am new to  development. Could you please help me on this requirement ?
    Thank you very much. 

    Hello,
    Use this link to to validate checkbox value, if true then set the person or group value (i.e. as posted in your link).
    http://geekswithblogs.net/haniamr/archive/2011/03/10/validate-that-a-checkbox-is-checked-using-javascript.aspx
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

Maybe you are looking for