SharePoint: EncodedAbsUrl and the Full URL of an SPListItem.


You want to get the full URL of an SPListItem, but the SPListItem.Url property returns only the server relative URL.

You could concatenate together the SPListItem.Web.Url and SPListItem.Url property values, alternatively you can use the ows_EncodedAbsUrl metadata value;

using (var site = new SPSite(webUrl))
using (var web = site.OpenWeb())
{
	SPList list = web.Lists["Shared Documents"];
	SPListItem item = list.Items[0];
	string itemUrl = item["ows_EncodedAbsUrl"].ToString();
}

The exact form of this metadata value seems to vary according to how it’s used, such as from an SPSiteDataQuery, as I mentioned in this post.

Published by

Phil Harding

SharePoint Consultant, Developer, Father, Husband and Climber.

3 thoughts on “SharePoint: EncodedAbsUrl and the Full URL of an SPListItem.

  1. Thank you it was very useful.

    It was my salution in SPservices.

    var f = “”+
    ”+
    ”+
    ”+
    ”+
    ”+
    “”;

    $().SPServices({
    operation: “GetListItems”,
    async: false,
    listName: list,
    CAMLViewFields: f,
    CAMLLimit: l,
    CAMLQuery: q,
    CAMLQueryOptions: qo,

    completefunc: function (xData, Status) {

    $(xData.responseXML).SPFilterNode(“z:row”).each(function() {

    var url = $(this).attr(“ows_EncodedAbsUrl”)

    $(“#tasksUL”).append(liHtml);

    });
    }
    });

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.