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.
thank you, that is what i was looking for
Thank you so much… you saved my time 🙂
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);
});
}
});