How to update person or group column with peopleeditor control values

Hi,
I have created custom aspx page and added "PeopleEditor" control(can select multiple users)  in that page. Now I am trying to update person or group column with peopleeditor control values.I am not getting any error if I select single user
in PeopleEditor control but getting error if I select more than one user.
UpdateItem(listItem, "ListColumnName",
listItem.ParentList.ParentWeb.EnsureUser(peopleeditorId.CommaSeparatedAccounts));
Can anybody help me out to resolve the issue?
Thank you in advance!!!
AA.

First get all the users/groups from the PeapleEditor by using PeapleEditor.ResolvedEntities
foreach (PickerEntity pickerEntity in peopleEditor.ResolvedEntities)
SPPrincipalType principalType = (SPPrincipalType)Enum.Parse(typeof(SPPrincipalType), pickerEntity.EntityData["PrincipalType"].ToString());
if (principalType == SPPrincipalType.User || principalType == SPPrincipalType.SecurityGroup)
string loginName = pickerEntity.Key;
//your code here
else if (principalType == SPPrincipalType.SharePointGroup)
string groupName = pickerEntity.Key;
//your code here
Add all the users/groups in an instance of SPFieldUserValueCollection
and then update your list item.
SPFieldUserValueCollection users = new SPFieldUserValueCollection();
users.Add(new SPFieldUserValue(web,user.ID,user.Name));
item["YourUserColumn"] = users;
item.Update();

Similar Messages

  • 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]

  • How to update front panel immediatel​y with any control change in LabVIEW7.0​?

    I have a lot of controls on the front panel. I want my 3D plot to be updated with any of them changed. Currently only one control's change can result in the update even if I do have done changes on other controls .. that's to say, only one specific control's change can activate the front panel updating ... That's not what I want. So how to make the front panel updated immediately like VC?
    Many thanks!

    I solve this problem by combining the event structure with a classical state machine. The classical state machine is a case inside a loop with either an enum or string shift register defining the actual state. In the idle case of that structure is the actual event structure which handles the UI.
    Whenever I need to trigger a specific action which could happen from multiple locations I actually place the handling code in a specific case in the outside state machine and just wire from the actual event case the according state out to the shift register.
    This architecture allows for a very flexible and extende state machine programming with the event structure doing all the UI event handling and the state machine doing the more involved actions or series of actions
    Rolf K
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Unable to select SOME external users in person or group column in SharePoint O365

    Here's a head scratcher.
    We have an O365 SharePoint(G3) instance.
    Sent external users invites to join the site from the SharePoint Group that the external user will be placed.
    External users accepted invitations and now have access to the site with the correct permissions.
    Permissions assigned to SharePoint Group.
    Some external users can be selected for "Assigned to" field (person or group column type).
    Some external users canNOT be selected for "Assigned to" field (person or group column type).
    When typing external users name that canNOT be selected, the error message "No results found" appears.
    Went to Site Settings > Site Permisisons > Check Permissions and typed in external users name that canNOT be selected, the error message "No results found" appears.
    I have no idea why this would happen for some external users and not others.
    External users that can be selected and those that canNOT be selected are in the same SharePoint Group and have the same permissions.
    Could this be due to how the external user set up their account?
    Help me please. This is driving my crazy.
    Thanks in advance.
    Tamara
    The Stumped SharePointer
    Tamara Bredemus SharePoint Minion...working up to Maven

    Hi Miikka,
    can you try cleaning up the user information list via powershell and reconfigure the userprofile sync.  following url contains the powershell script for user information clean up
    http://blog.fpweb.net/how-to-clean-up-sharepoint-user-information-list-with-powershell/#.VPrbn_mUeSo
    Regards  Roy Joyson
    Please remember to mark your question as "answered"/"Vote helpful" if this solves/helps your problem.
    Roy Joyson

  • Person or Group column problem

    Hi, I have quite tricky problem with Person or Group column. We use that column in quite many places. When I create new item or edit list item properties I can find person just fine for example with lastname and choose it but when I save that
    item the persons name changes to someone else of our users.
    What I noticed is that if I search person with beginning of their email address (firstname.lastname) everything is good even after I save the item. With some persons it works even if I find them with lastname.
    Is there something to do with users ID in Site Collection hidden user information list vs User Profile Database?
    Any ideas. Thank you.
    Miikka

    Hi Miikka,
    can you try cleaning up the user information list via powershell and reconfigure the userprofile sync.  following url contains the powershell script for user information clean up
    http://blog.fpweb.net/how-to-clean-up-sharepoint-user-information-list-with-powershell/#.VPrbn_mUeSo
    Regards  Roy Joyson
    Please remember to mark your question as "answered"/"Vote helpful" if this solves/helps your problem.
    Roy Joyson

  • What is difference between distribution list and share point group? Can we add distribution list into person and group column of share point list?

    what is difference between distribution list and share point group? Can we add distribution list into person and group column of share point list?

    there is a workaround you can try, create audience and add DL to them and deal with the audience or convert DL to groups
    https://social.technet.microsoft.com/Forums/en-US/02f0d773-8188-4d94-a448-0c04d838b0cf/distribution-lists-in-sharepoint?forum=sharepointgenerallegacy
    Kind Regards,
    John Naguib
    Technical Consultant/Architect
    MCITP, MCPD, MCTS, MCT, TOGAF 9 Foundation
    Please remember to mark your question as answered if this solves your problem

  • Person and Group column in Document Information Panel in Word

    Hi All,
    Environment: SharePoint 2010 and Claims based Authentication.
    We have a library with "Person and Group" column, "Choose from:" is set to "All Users" and in the "Document Information Panel" when I click on the Address Book (book symbol) it doesn't open the popup to select  the
    user nor it resolves the ids that I put in.
    But if I change the setting for "Choose from:" to "SharePoint Group:" and select any group (tested randomly with some existing groups in that site), now when I click on the Address Book in the DIP it gives me the popup and also resolves
    the ids.
    Any help would be appreciated.

    http://social.technet.microsoft.com/Forums/sharepoint/en-US/868b7d59-06e7-437f-8a3e-5f49e51c7b8d/people-picker-render-error-in-document-information-panel
    Have you by chance looked at ULS logs or taken a network trace during the time the People Picker control is attempting to be rendered? 
    It seems to be a client-side issue. GPOs have been applied to "secure" Office2010.
    Have you ever heard of GPOs causing such issues? As far as I know the people picker is an ActiveX control. There are two settings in the GPO which have something to do with Active X:
    Active X Control Initialization
    Check Active X Objects
    Windows Internet Explorer Feature Control Opt-In
    Beaconing UI for forms opened in Infopath Filler Active X
    Bind to Object
    If this helped you resolve your issue, please mark it Answered

  • How do I create Equal Height Columns with my Background Images?

    Hi there,
    here is my page http://www.allthingsprintuk.co.uk/ATPHome.html
    My problem is that the side bar HTML list is coming off the page in IE. & also the html  in the header can look awful due to browser settings.
    My question is how do I create Equal Height Columns with my Background Images so that they fit with the HTML text? Is there a good link you can point me to, or a tutorial?
    The only way I can see by doing it is slicing my images up into 3 (top middle & bottom) & then setting the middle to repeat y????
    Or does anyone know of a way to create rounded corners WITH drop shadows in CSS that will work on all browsers?
    Thanks in advance
    Louisa

    Try these http://www.pixelan.com/

  • Filter base on Person or Group column does not work correctly in sharepoint 2013

    I have a list that contain "Person or Group"column that set "Allow Multiple Selections" to yes.
    In sharepoint 2010 I create view and filter it base on this person or group column equal to [Me]. And it's work correctly.
    Now in sharepoint 2013 when I filter view, base on this person or group column equal to [Me], it does not show me any items, although list has data that person or group column set to me.
    What's wrong?
    Thanks.

    If you want to filter the list view when current user is in the group, then I recommend to use theMembership comparator in the
    query and add it to the view page in SharePoint Designer:
    <Where><Or><Membership Type="CurrentUserGroups"><FieldRef Name="AssignedTo"/></Membership><Eq><FieldRef Name="AssignedTo"/><Value Type="Integer"><UserID Type="Integer"/></Value></Eq></Or></Where>
    More reference:
    http://decodesharepoint.blogspot.com/2010/01/filter-list-views-by-user-groups.html

  • How to display more than one column with for each

    Hi guys,
    how to display more than one column with for each like below?
    for each
    Item1
    Item2
    Item3
    Item4
    Item5
    Item6
    Item7
    Item8
    Item9
    Item10
    End for each
    for each          
    Item1     Item2     Item3
    Item4     Item5     Item6
    Item7     Item8     Item9
    Item10          
    End for each

    Take a look at this to see if the solution provided would work for you: https://blogs.oracle.com/xmlpublisher/entry/multi_column_row_woes
    Won't you have more than 10 records in your data file ? If you are going to have only 10 items then you may be able to use position() function to limit it to 3 each..
    Take a look at this: https://blogs.oracle.com/xmlpublisher/entry/turning_rows_into_columns
    Thanks,
    Bipuser

  • HT4623 I'd like to know how I update my apple iphone 3G with ios 4.2.1 to ios 6. Thanks.

    I'd like to know how I update my apple iphone 3G with ios 4.1.2 to ios 6? Thanks, LabRat1.(?!)

    Read https://discussions.apple.com/static/apple/tutorial/reputation.html
    Status Level
    Points
    Privilege
    Level 1
    0-149
    Level 2
    150-499
    Report Post
    Level 3
    500-999
    Custom Avatar
    Level 4
    1,000-3,999
    Conference Calls
    Level 5
    4,000-7,999
    User Tips
    Level 6
    8,000-19,999
    Lounge Access, MVP Meetups
    Level 7
    20,000-34,999
    Level 8
    35,000-49,999
    Level 9
    50,000-79,999
    Level 10
    80,000+

  • How to update zero to a column value when record does not exist in table but should display the column value when it exists in table?

    Hello Everyone,
    How to update zero to a column value when record does not exist in table  but should display the column value when it exists in table
    Regards
    Regards Gautam S

    As per my understanding...
    You Would like to see this 
    Code:
    SELECT COALESCE(Salary,0) from Employee;
    Regards
    Shivaprasad S
    Please mark as answer if helpful
    Shiv

  • How to get sum of quantity column in table control

    Hi, expert ,
    Someone can guide me how to get som of qty column in table control ?
    I created a screen with a table control  and has a  qty quantity field .
    I want to show total of qty  in a  field .
    my code like this ...
    PROCESS AFTER INPUT.
      LOOP AT I_tab.
        CHAIN.
           FIELD I_tab-COUNTQTY MODULE  caculate_total_qty .
        endchain.
        MODULE UPDATE_TOTAL_QTY  .
      ENDLOOP.
    but, when I Back to the previous screen
    It's caculate again so I always get wrong Total quantity .
    anyone can help me ...

    Hi , Dhina
    I have another question .
    I use internal table data in table control to update  database table .
    The data in the db will be change ,
    but each record I want to delete in table control , it's still exist in database .
    my code is
    WHEN 'SAVE'
         MODIFY YDSGBT53 FROM TABLE I_YDSGBT53 .
         COMMIT WORK .
      END CASE
    How  to fix my code and let it can change and delete data in database  ?
    or
    when I delete record  in table control I must to delete data in the database too .
    Edited by: TitusFang on Jun 16, 2011 3:21 AM

  • How to find out the selected column in Table Control

    Hi all,
          How to find out the selected column in Table Control?
    Thanks & Regards,
    YJR

    Hi,
    Let your table control name in Screen painter be TC1.
    READ TABLE TC1-COLS INTO WA_COLS (some wok area)
                 WITH KEY SELECTED = 'X'.
            IF SY-SUBRC = 0.
              CLEAR: W_DUMMY, W_COL_NAME.
              SPLIT WA_COLS-SCREEN-NAME AT '-' INTO W_DUMMY
                                                   W_COL_NAME.
            endif.
    W_COL_NAME gives you the column name.
    Hope it helps.
    cheers
    sharmistha

  • Column with header data value

    Hi All.
    I have a control file which i need to add a column with header data value.
    example
    data file:
    123456;201303
    santiago;producto1;100
    santiago;producto2;200
    valparais;producto1;400
    valparais;producto3;900
    The control file skip the first column and load the three columns on the table, but, now i need to add other column with 201303 value constant of the first record and load it on the table.
    Then
    select * from table:
    santiago producto1 100 201303
    santiago producto2 200 201303
    valparais producto1 400 201303
    valparais producto3 900 201303
    How i do this in the control file?
    Regards!

    SCOTT@orcl_11gR2> host type test.dat
    123456;201303
    santiago;producto1;100
    santiago;producto2;200
    valparais;producto1;400
    valparais;producto3;900
    SCOTT@orcl_11gR2> host type test1.ctl
    options (load=1)
    load data
    infile test.dat
    replace
    into table onecol_onerow
    fields terminated by ';'
    trailing nullcols
    (filler1 filler, newcol)
    SCOTT@orcl_11gR2> host type test2.ctl
    options (skip=1)
    load data
    infile test.dat
    append
    into table test_tab
    fields terminated by ';'
    trailing nullcols
    (col1, col2, col3,
    newcol expression "(select newcol from onecol_onerow)")
    SCOTT@orcl_11gR2> create table onecol_onerow
      2    (newcol number)
      3  /
    Table created.
    SCOTT@orcl_11gR2> create table test_tab
      2    (col1   varchar2(15),
      3     col2   varchar2(15),
      4     col3   number,
      5     newcol number)
      6  /
    Table created.
    SCOTT@orcl_11gR2> host sqlldr scott/tiger control=test1.ctl log=test1.log
    SQL*Loader: Release 11.2.0.1.0 - Production on Mon May 6 10:46:44 2013
    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
    Commit point reached - logical record count 1
    SCOTT@orcl_11gR2> select * from onecol_onerow
      2  /
        NEWCOL
        201303
    1 row selected.
    SCOTT@orcl_11gR2> host sqlldr scott/tiger control=test2.ctl log=test2.log
    SQL*Loader: Release 11.2.0.1.0 - Production on Mon May 6 10:46:45 2013
    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
    Commit point reached - logical record count 4
    SCOTT@orcl_11gR2> select * from test_tab
      2  /
    COL1            COL2                  COL3     NEWCOL
    santiago        producto1              100     201303
    santiago        producto2              200     201303
    valparais       producto1              400     201303
    valparais       producto3              900     201303
    4 rows selected.

Maybe you are looking for