SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to get the Unique Id from a listitem in a custom SharePoint 2010 list? I've added a custom ribbon action so far where I can get the id, but that's an integer (0,1,2,3,...) I need the unique Guid of that listitem.

Anyone knows if this is possible and if so, how can it be done?


share|improve this question
why not integet Id so you can use GetItemById method? – Hameds May 22 '12 at 10:56
The problem with this is that the listitems change a lot. If someone gets the id, the listitem can allready be gone. That's why I use the UniqueId, so I won't get any mistakes. And I can use the GetItemByUniqueId() method to get it also. – Ruben Herman May 22 '12 at 11:09
up vote 4 down vote accepted

Here is a script that gets the UniqueId of a list item:

<script type="text/javascript">

          var itemId = ....; // change to the real id
          var listTitle = .... // the list title

          var ctx = SP.ClientContext.get_current();
          var list = ctx.get_web().get_lists().getByTitle(listTitle);

          var item = list.getItemById(itemId);

                  function ()
                     alert('Request succeeded. \n\nRetrieved Item is: ' + item.get_item('UniqueId'));

                  function(sender, args)
                          alert('Request failed. \nError: ' + args.get_message() + '\nStackTrace: ' + args.get_stackTrace());
        }, "sp.js");

Hint: If your ribbon action is used in a list view, then you could use the following to get the current list:

var listId = SP.ListOperation.Selection.getSelectedList();
var list = ctx.get_web().get_lists().getById(listId);
share|improve this answer
Thanks, I'll test this right away! – Ruben Herman May 22 '12 at 11:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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