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 want to get URLs from SharePoint Links list using client object model javascript, can someone help me, I tried the following script but when I am alerting its result it shows me the URL value as [object Object] but not the actual URL.

<script type="text/javascript">

var siteUrl = '/';

function retrieveListItems() {
    var clientContext = new SP.ClientContext(siteUrl);
    var oList = clientContext.get_web().get_lists().getByTitle('Links');

    var camlQuery = new SP.CamlQuery.createAllItemsQuery();
    this.collListItem = oList.getItems(camlQuery);


    clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));        


function onQuerySucceeded(sender, args) {

    var listItemInfo = '';

    var listItemEnumerator = collListItem.getEnumerator();

    while (listItemEnumerator.moveNext()) {
        var oListItem = listItemEnumerator.get_current();
        listItemInfo += '\nID: ' + oListItem.get_id() + 
            '\nURL: ' + oListItem.get_item('URL');
            //'\nFieldName: ' + oListItem.get_item('Notes');


function onQueryFailed(sender, args) {

    alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}</script><input id="button1" onclick="retrieveListItems()" type="button" value="GetItems"/>
share|improve this question
up vote 2 down vote accepted

You need to use .get_url()

This should work:

var oListItem = listItemEnumerator.get_current();
        listItemInfo += '\nID: ' + oListItem.get_id() + 
            '\nURL: ' + oListItem.get_item('URL').get_url();
share|improve this answer
Thanks worked! – RHM Feb 19 '13 at 13:43
Np, same goes for other types too, like lookup. You should take a look in the SP.Namespace overview: – Anders Aune Feb 20 '13 at 8:36
thanks.......... – RHM Feb 21 '13 at 13:58

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.