How do I populate a "Person or group" field via Elements.xml?

So I have created a field titled "EmployeeName" and it's a "Person and Group" type. (View the Schema.xml below)
<Field Name="EmployeeName" ID="{8579a35a-71a8-4070-b907-b6ede0daa352}" DisplayName="Employee Name" Type="User" />
Now, I'm trying to populate the column via the Elements.xml file. As you can see by the commented out code below, I've tried every combination and I'm still unable to populate this column:
<ListInstance Title="Employee_Rec_list" OnQuickLaunch="TRUE" TemplateType="10000" Url="Lists/Employee_Rec_list" Description="My List Instance">
<Data>
<Rows>
<Row>
<!-- <Field Name="EmployeeName">i:0#.f|membership|[email protected]</Field>
<Field Name="EmployeeName">i:0#.f|membership|[email protected]</Field>
<Field Name="EmployeeName">0#.f|membership|[email protected]</Field>
<Field Name="EmployeeName">#.f|membership|[email protected]</Field>
<Field Name="EmployeeName">[email protected]</Field> -->
<Field Name="EmployeeName">[email protected]</Field>
<Field Name="Achievements">Rock Star</Field>
<Field Name="Achieve_x005f_Des">Cras congue varius metus, in tincidunt metus Vestibulum vel turpis nec leo porttitor pulvinar fringilla ut lacus. a dictum aliquam. Pellentesque non felis cursus, lobortis, mattis arcu. Duis molestie nisi quis lectus tincidunt, a porttitor turpis iaculis. Donec condimentum, tellus sit amet hendrerit aliquet, est eros faucibus nulla, eu ultricies ligula ante id quam. Suspendisse suscipit orci sit amet vestibulum ultrices. Nunc dictum tortor non magna volutpat</Field>
</Row>
</Rows>
</Data>
</ListInstance>

Ok I figured it out. You need to you use the users ID.
<Field Name="EmployeeName">15</Field>

Similar Messages

  • How to Insert Sharepoint 2013 Person or Group Field using VBA

    Hello,
    How to Insert Sharepoint 2013 Person or Group Field using VBA , I tried set the field with ID / ID;Name / Name
    but all failed, Please advice 
    Function SetSP_Field(F_Yer As Single, F_WekNo As Single, F_ProjectNum As String, strField As Variant, strFieldValue As Variant) As String
    ' test code
        Dim rst         As Recordset
        Dim strSQL      As String
        Dim SP_RecSet   As ADODB.Recordset
        Set SP_RecSet = New ADODB.Recordset
        SetSP_Field = False
        strSQL = "Status Report"
        On Error Resume Next
        Call SP_Connect(2)
        strSQL = "select " & SP_List & ".* From  " & SP_List _
               & " Where [Year] = " & CInt(F_Yer) _
               & "   and [WeekNo] = " & CInt(F_WekNo) _
               & "   and [Compass_Code] = '" & F_ProjectNum & "' ; " _
    '           & " Set " & strField & " = " & strFieldValue
        'Debug.Print strSQL
        'Debug.Print SP_CN
        SP_RecSet.Open strSQL, SP_CN, adOpenStatic, adLockOptimistic
        If SP_RecSet.RecordCount = 0 Then
            Debug.Print "Record for project: " & F_ProjectNum & " not found"
            LogFile.WriteLine ("Record " & strID & " not found")
        End If
        If Not SP_RecSet.EOF Then
            'SP_RecSet.Edit
            SP_RecSet.Fields(strField) = strFieldValue
            SP_RecSet.Update
            If Err.Number <> 0 Then
                MsgBox ("SP Update Error: " & Err.Description)
                GoTo Exit_Fun
            End If
            SetSP_Field = True
        End If
    Exit_Fun:
        SP_RecSet.Close
        Set SP_RecSet = Nothing
    End Function

    Hi Tim,
    Let’s verify the followings:
    Whether this issue occurred for other lists in the same site.
    Whether this issue occurred for all users who don’t have full control.
    Whether this issue occurred on other sites.
    When you created the people & group column, which show field did you used? Please try to use a different show field for the people & group column, compare the result.
    In addition, please check if the link is useful:
    http://www.learningsharepoint.com/2013/08/21/empty-value-in-people-picker-after-saving-the-list-form-in-sharepoint/
    Best Regards,
    Wendy
    Wendy Li
    TechNet Community Support

  • How to add users from person or group field in a sharepoint list to sharepoint group

    Hi,
    How to add users(single or multiple) from person or group field in a sharepoint list to sharepoint group programmatically?
    Any suggestions would be appreciated.
    Thank you,
    AA.

    Hello,
    Use SPGroup.AddUser() method to add user in group. I have just written sample code in notepad so it is not tested:
    SPSecurity.RunWithElevatedPrivileges(delegate()
    using(SPSite Site = new SPSite(SPContext.Current.Site.Url))
    Using(SPWeb Web = Site.OpenWeb())
    SPList list = web.Lists["ListName"];
    SPQuery query=new SPQuery ();
    query.Query = "<Where><Eq><FieldRef Name='Title' /><Value Type='Text'>Test</Value></Eq></Where>";
    SPListItemCollection items = list.GetItems(query);
    if(items.Count > 0)
    foreach(SPListItem item in items)
    //Get USers from person or group column
    SPFieldUser userField = (SPFieldUser)item.Fields.GetField("Users");
    SPFieldUserValueCollection userFieldValueCollection = (SPFieldUserValueCollection)userField.GetFieldValue(item["Users"].ToString());
    SPGroup spGroup = spSite.RootWeb.Groups[groupName];//group name
    if (users.Count != 0)
    bool isUserInGroup = false;
    foreach (SPFieldUserValue user in users)
    foreach (SPUser item in spGroup.Users)
    string itemUserName = item.LoginName;
    string UserName = user.User.LoginName;
    if (itemUserName == UserName)
    isUserInGroup = true;
    break;
    if (!isUserInGroup)
    spGroup.AddUser(user.User);
    The above code will query list item and then get users from "Users" column. Now it will check whetehr user is already in group not, if not then add user in group.
    http://rajanijilla.blogspot.sg/2012/09/add-users-to-group-programmatically.html
    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

  • Copy person & group field value to another person or group field programmatically

    Hi 
    I have one user list in SharePoint sitecollection1 having User in Title(having simple user name) and UserName in Person or Group type field.
    I want to copy this list into my site list with same column names programatically using timer job.
    How I can copy the person or Group field from siteColletion1 to person or group field of sitecollection2(my site),
    as both column types are same.
    Pleas suggest any solution.

    I am getting user name and user id using following code,
    foreach (Microsoft.SharePoint.Client.FieldUserValue userValue in oclistItem["UserName"] as Microsoft.SharePoint.Client.FieldUserValue[])
    string username =    userValue.lookupValue.tostring();                               
    But how to get the login name ? or how can I get the User Object from this field?
    Anybody got this type of issue before.
    Please suggest any solution

  • How to modify person or group field value with new value

    Hi
    I have person or group field having property Person Only.
    Thsi firls already have one value. Now I want to update it but this code to update value is not working.
    string myName = @"ABC\myname";
    web.EnsureUser(myName);
    SPUser myUser = web.SiteUsers[myName];
    SPFieldUserValue myNamevlaue = new SPFieldUserValue(web, myUser.ID, myUser.LoginName);
    oSplistItem["My_x0020_User"] = myNamevalue;
    oSplistItem.Update();
    I am getting myNamevalue correct in the veriable. But why its not updating in the list?
    is there any issue in the above code?
    Do I need to delete previous value and then update new value in this field? How?

    Hi,
    The format of the user value in people/Group field must be
    ID;#Name, you can use the following code snippets to update the people/group field.
    string loginName = "ABC\\myname";
    SPUser user = web.SiteUsers[loginName];
    SPList list = web.Lists.TryGetList("ListName");
    if (list == null)
    Console.WriteLine("list is not exist!");
    return;
    SPListItem item = list.GetItemById(3);
    item["My_x0020_User"] = user.ID.ToString() + ";#" + user.Name;
    item.Update();
    Thanks,
    Jason
    Please remember to mark the reply as answer if it help, and unmark the answer if it provide no help.

  • Sorting and filtering by select-multi person or group field in the list in SharePoint 2013

    Hi everybody,
    In SharePoint 2013, I have defined a column as "Person or Group" field, which you allow for multiple selections. when I try to sort/filter it by this field in the list. The field doesn't show up in the dropdown. If I changed "Allow multiple
    selections" option to "No" by clicking the column name to edit it in "List Settings", the field can show up sort in the dropdown.
    How about support sorting and filter by select-multiple "Person or Group" field in sharepoint 2013?
    BTW, in SharePoint 2010, it can support this issue no matter what the "Allow multiple selections" option the request is.
    Any help would be great!
    Thanks,
    Jodie

    Hi Jodie,
    Can you please give this as a try.
    To fix the Filter Issue on Assigned To Column. We need to run the following scripts.
    The field which allows more than one values or which allows multiple selections. The multi-valued fileds are non-sortable,
    non-filterable. Multi-valued fields cannot be indexed
    $web=Get-SPWeb
    $list=$web.Lists[] $field=$list.Fields[ColumnName] $strSchema=$field.SchemaXml $str=Schema$strSchema.Replace("Sortable=`"FALSE`"","Sortable=`"true`"")
    $field.SchemaXml = $strSchema
    Krishana Kumar http://www.mosstechnet-kk.com
    Thanks for your reply, I have tried to run the scripts, but it still cannot work. The following is my scripts:
    $web=Get-SPWeb 'http://cst-server-01'
    $list=$.web.Lists["Product Request"]
    $field=$list.Fields["Applicant"]
    $strSchema=$field.SchemaXml
    $str=Schema$strSchema.Replace("Sortable='"FALSE'"", "Sortable='"True'"")
    $field.SchemaXml = $strSchema

  • Save history values of person or group field in another person or group field

    Hi
    I have a person or group field in sharepoint list that users can assign task to colleagues by this column. Every time value of this field changed and I want to save
    these values in another person or group field (for history and 
    filter view base on it).
    How I can do this?
    Thanks.

    I create workflow variable and give it these values:
    First Person/Group value,(Display Names, Semicolon Delimited),
    Second Person/Group value,(Display Names, Semicolon Delimited)
    Then I set this variable to Second Person/Group but it's give me error and does not work.

  • Formula to populate one Person or Group column depending on the value of another Person Group column

    I am looking for a way to popluate the Account information of a Person based on another column where there name in another column.  I have Two Columns   "Name" which is a Person or Group information type and User Account which
    is also a Person or Group Information type.  When an Invidividuals name is entered into the Name column, I what the User Account column to prepolulate.

    Hi,
    For your issue, you can automatically populate User Information depending on the value of another Person or Group column by connectting with User Information List or  connectting with User Profile Web Service:
    http://www.wonderlaura.com/Lists/Posts/Post.aspx?ID=172
    http://blogs.technet.com/b/anneste/archive/2011/11/02/how-to-create-an-infopath-form-to-auto-populate-data-in-sharepoint-2010.aspx
    Best Regards,
    Eric
    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]

  • Workaround to using "Person or Group" field in a "Calculated" column formula?

    Apparently, SharePoint does not allow you to insert a "Person or Group" column into a "Calculated" field's formula.
    Is there a workaround to adding a "Person or Group" column into a "Calculated" field's formula?
    -Maybe a way of coverting the data from the Person or Group column into a text field, and referencing that text field in the formula?
    Microsoft mentions only Columns of the following data types can be referenced in a formula: single line of text, number, currency, date and time, choice, yes/no, and calculated.

    Hi AskMicrosoft,
    Have you tried to use a workflow?
    1 Create a new text column in the list.
    2 Create a workflow and use
    Update item in this list Action > Add the new text column to the value in people and group column.
    Then you can add the text column in calculate formula.
    Hope it helps.
    Best regards. Emir

  • Person or Group field not storing data that is entered.

    Hi guys,
    I'm having a bit of a frustrating time trying to import the records of 900+ staff members into a list and then create a view that shows only the currently signed in user.
    Now I've got my list all sorted out lovely and the way we have it set up is that the users payroll ID is their unique ID for everything, their log in for AD and SharePoint. This gives us a nice advantage and I'd hoped that with a column in our list with
    the users Payroll ID we could use that to match the username of the currently logged in user, I was wrong as it will only allow me to use a person or group column.
    MY ISSUE is that when trying to copy the column containing the Payroll ID, which is also the users username in SharePoint, in Datasheet view into the person/group column I get the following error for most of records (some of them do work and contain the
    information correctly).
    "The text entered for Username isn't an item from the list. Select an item from the list, or enter text that matches one of the listed items."
    After getting frustrated at that I then edited our Info Path form for users to modify their details with and added a field that linked to the column. When in the form this field accepts the payroll ID and outputs the users SharePoint name (not username)
    as expected but when saving the form it doesn't update the column.
    Any suggestions?

    I suspect the reason you can't insert the users automatically is that the users haven't visited or been mentioned on that site previously. SharePoint caches user data (in the hidden user information list) on each site collection which means that if you were
    to copy and paste a user who hasn't been on the site before it'll fail to find them in the cache. In normal circumstances using the people picker it'd identify the cache is empty and check for the user in AD but it may be failing for you in datasheet view.
    To confirm find one of the users that failed as part of the C&P, add an entry for them manually, delete it and then re-try the copy and paste.

  • "Person or Group" Field in List instance (Schema.xml)

    hi all,
    I created new List instance and I added new Field Employee to the list instance. The Employee field  in the Schema.xml is like:
    <Field Name="Person" ID="{f3c1416f-69dd-4172-b05f-5df45c86ee56}" DisplayName="Person" Type="UserMulti" Mult="TRUE" /></Fields>
    and this work fine.
    But I cant see the EntityEditor like below pic:
    they are disapear.
    Can anyone maybe help me?
    P.S.  I created one column via UI on the same list and in the SharePoint Manager 2013.
    Its the same I dont see the EntityEditor and here is the Schema.xml for the test column:
    <Field Type="UserMulti" DisplayName="test444" List="UserInfo" Required="FALSE" EnforceUniqueValues="FALSE" ShowField="ImnName" UserSelectionMode="PeopleAndGroups" UserSelectionScope="0"
    Mult="TRUE" Sortable="FALSE" ID="{aefd55b0-3d3e-44ba-a649-82391061ca38}" SourceID="{93681c67-ca5f-4598-a412-3efee82a18d6}" StaticName="test444" Name="test444" ColName="int3" RowOrdinal="0"
    />
    thank you in advance
    BR
    Ahmad

    Hallo Mr. Sabir,
    sorry I was sick and I couldn't answer you before :-(.
    I use SP 2013 (and not SP 2010, maybe I must Active a feature!) and in my Schema.xml I have exacly the Schema:
     <Field Name="Person"
                 ID="{f3c1416f-69dd-4172-b05f-5df45c86ee56}"
                 DisplayName="Person"
                 Type="User"
                 Required="FALSE"
                 ShowField="ImnName"
                 UserSelectionMode="1"
                 UserSelectionScope="0"
                 Group="Custom Columns"
                 StaticName="MyUserColumn"
                 />
    srv206/Lists/CustomList/NewForm.aspx
    when I open the above URL  I get like below picture:
    if you or other one here have/has an advice or other idea thanks in advance
    BR
    Ahmad
    SP 2013 & SPD 2013 & VS 2013 & MSSQL 2012

  • How do I populate the "incoming mail server" field in mail.

    My icloud account is not able to send or recieve emails. Other accounts are. When checking preferences I see the Incoming mail server field is empty and I can not populate it. How can I get round/fix
    this, please?

    Your iCloud email account is automatically set up when you check Mail in System Preferences.
    Go to System Preferences>iCloud, uncheck Mail, restart your Mac, then go back and check Mail again.  This will remove, then automatically set up your iCloud email account again with the proper settings.

  • ..how do you group fields together in xml into one field? (sql:- address_line1||', '||address_line2||', '|| )

    afternoon Gurus.
    I take it by the errror messages produced I'm not able to do this..
    select ....
    address_line1||', '|| address_line2||', '|| address_line3||', '|| city|| Supplier_Address
    from...
    ..in my XML Publisher xsl Data Template file..
    Caused by: org.xml.sax.SAXParseException: <Line 13, Column 20>: XML-20201: (Fatal Error) Expected name instead of |.
    So how can I acheive putting several fields into one like you can in SQL?
    THanksForLooking..
    Al

    Untested, but try the following:
    SELECT DISTINCT
           fnd.CREATION_DATE
          ,fnd.user_name
          ,fnd.start_date
          ,per2.last_updated_by
          ,per2.last_update_date
          ,per2.employee_number
          ,per2.EMAIL_ADDRESS
          ,per2.full_name
          ,fnd.LAST_LOGON_DATE
    FROM fnd_user fnd
    where fnd.End_Date is null
    left outer join per_people_f per2 on (     fnd.employee_id              = per2.person_id
                                           and SUBSTR(per2.LAST_NAME, 2, 6) not like 'some characters'
                                           and per2.EMAIL_ADDRESS           LIKE '%priddle%' )
    ORDER BY 2 ASC;Investigate multiple outer joins using the LEFT OUTER JOIN syntax
    http://download.oracle.com/docs/cd/E11882_01/server.112/e10592/queries006.htm#SQLRF52354

  • How to [b]update[/b] [b]sdo_geometry[/b] field via [b]Database Link[/b]

    I need to update a geom field(defined as mdsys.sdo_geometry) of a remote table via database link,but I failed; This is the SQL statement and the error;
    update [email protected] set shape=mdsys.SDO_GEOMETRY(2002, NULL, NULL, mdsys.SDO_ELEM_INFO_ARRAY(1, 2, 1), mdsys.SDO_ORDINATE_ARRAY(2340411, 749349.375, 2340505.75, 749663.25, 2340571.75, 749924.813))
    where objectid=1;
    ORA-22804: remote operations not permitted on object tables or user-defined type columns
    How could I update geometry field of a remote table?
    Is there any method available ?
    Thanks!!

    Hi Percy,
    Oracle distributed does not support objects. If you are using 9i there might be just enough functionality to support what you want to do (replication required some distributed support, which might be enough for you).
    If it doesn't work then you may be out of luck with respect to distributed support, but you can connect to the remote database and update it that way.

  • How to intercept variables in report's formula field via TOAD?

    I have a case in this report. I have a report that generates a list of items with info of their initial stock, stock movements and final stock. no problem for the in and out stock movements.
    but there's a slight problem with the initial stock. I wrote a formula field that executes several select queries to obtain the inital stock. The XML report format roughly looks like this:
    Item_Name Initial_Stock Stock_In Stock_Out Final_Stock
    <?Item_name?> <?CF_Init?> <?In?> <?Out?> <?CF_Final?>
    As you can see, the Initial Stock and Final stock data is obtained through a formula field. And the select queries I mentioned above are employed in the formula fields. The rest of the fields are obtained directly from the SQL field in the report. Right now the report generates all items, whether their initial stock is zero or not. What I'm trying to do is not displaying items whose initial stock, stock in, stock out and final stock are zero. thanks
    Edited by: 801264 on Oct 14, 2010 9:22 PM
    Edited by: 801264 on Oct 14, 2010 10:39 PM

    Well you could try upgrading to a more recent Java runtime for starters.
    This is a native crash, which means something went wrong outside of Java code. The trouble is that you can't know WHERE it happens; The JVM itself is only a client of the machine it runs in and can be made unstable by outside influence. Under Linux it takes only one wonky shared library. It could be a driver. It could be a problem in the kernel. It could be another process. It could be anything.
    It could also be a bug in the JVM of course, but the only way you have a right to report it as a bug is if you try to see if the problem persists under the latest update.

Maybe you are looking for