Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11508

Add multiple people using Javascript Client Object Model

$
0
0

I am trying to add multiple people to a SP column of type Person/Group i.e. people picker. I am able to add one successfully using their userId, but HAVE no clue how to do that for multiple people. Here is the code for one user:

function UserDrop(e, toElement, listGuid, columnName) {

    
//EcmaScript Client Object Model
    var ctx = new SP.ClientContext.get_current();
    var list = ctx.get_web().get_lists().getById(listGuid);
    var item = list.getItemById(elementId);
//columnName is of type person/group and I am adding user //whose userId is 7
    item.set_item(columnName, 7);
    item.update();

    // asynchronous call
    ctx.executeQueryAsync(
        function () { toElement.innerHTML = userLinkHtml; },
	    function () {alert ("Error")}
        );

    return false;
}

This works great and I can add user whose userId is 7, however I want to add multiple people like let's say users of user Ids 7 and 8. 

Any ideas or help will be greatly appreciated. 

There is a thread on this one but that's from .net COM which could accessed here: http://social.msdn.microsoft.com/Forums/en-US/sharepoint2010general/thread/5183e87c-ee1d-4594-9492-0dfdf6616cce


7929


Viewing all articles
Browse latest Browse all 11508

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>