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

I defined a list where a Summary list is a coloum, in my javascript code i want to read the values of the links one by one...

sliderText = listItem.get_item('Description0');
sliderTitle = listItem.get_item('Title');
sliderLinks = listItem.get_item('SummaryLinks');

So the value of sliderLinks now is:

<div title="_schemaversion" id="_3">
  <div title="_links">
    <div title="_link">
      <span title="_title">Home</span>
      <span title="_order">1</span>
      <span title="_begincolumn">True</span>
      <span title="_linkurl">
        <a href=""></a>
  <div title="_view">
    <span title="_columns">1</span>
    <span title="_linkstyle"></span>
    <span title="_groupstyle"></span>

in the COM, isn't there functions to get the value of the URL and title instead of this HTML code?

share|improve this question
up vote 1 down vote accepted

Unfortunately the only thing CSOM gets from the server is the HTML (you can see that if you use fiddler while executing the request).

So you'll have to dig the values out of the html. If you've included jQuery you can do something like this:

    var sl = jQuery('<div></div>').html(listItem.get_item("SummaryLinks"));
    sl.find('div[title="_link"]').each(function (index, element) {
        var title = $(this).find('span[title="_title"]').text();
        var url = $(this).find('span[title="_linkurl"]').text();
        alert(title + '\n' + url);
share|improve this answer
+1 for mentioning fiddler :) – Haadka Apr 8 '12 at 10:49

I've written a JavaScript module in an attempt to fix this shortcomming in JSOM:

With that module, you would be able to iterate the links with the following code:

var fieldValueXml = listItem.get_item('SummaryLinks');
var fieldValueObject = new oPB.SummaryLinkStore(fieldValueXml);
var summaryLinks = fieldValueObject.summaryLinks(); //returns an array
for(var i = 0, n = summaryLinks.length; i<n; i++)
    var summaryLink = summaryLinks[i];
    if(summaryLink.isGroupHeader()) //your example contains no group header, so if you're sure that will never happen, you limit your code to the else statement.
        var groupedLinks = summaryLink.summaryLinks();
        for(var x = 0, y = groupedLinks.length; x<y; x++)
            var linkInGroup = groupedLinks[x];
            alert(summaryLink.title() + " contains:" + linkInGroup.linkUrl());
        alert(summaryLink.linkUrl()); //alerts url of link, other properties are available.

I've tried to build the module in a way that it should support any kind of operation you would like to do on the SummaryLink field and in the end be able to parse it back, so you can update the value in the list item.

My module does not make use of jQuery (or any other JavaScript library), so there should be no conflict with any JavaScript library you might want to use for other applications.

share|improve this answer

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.