In SharePoint lists and libraries we have a default list item view. If I select 20 items from default list view as I am selecting check box from default view, how can I get those selected item ID:s programmatically?

1 Answer 1


This can be done by writing client side object model code:

function GetSelectedItems() {
    var context = SP.ClientContext.get_current();
    var selectedItems = SP.ListOperation.Selection.getSelectedItems(context);
    var listId = SP.ListOperation.Selection.getSelectedList();
    var itemIds = "";
    for (var i = 0; i < selectedItems.length; i++) {
        itemIds += selectedItems[i].id + ",";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.