Monday, October 3, 2011

How to get the full URL from SPListItem in SharePoint

 
1.

static string GetItemUrl(SPListItem listItem)
{
return string.Format("{0}{1}?ID={2}", listItem.Web.Site.Url,
listItem.ParentList.Forms[PAGETYPE.PAGE_DISPLAYFORM].ServerRelativeUrl,listItem .ID);
}


2.

listItem.Web.Url  + the listItem.URL


3.

foreach (SPListItem listItemin list.Items)
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(listItem.Xml);
XmlNamespaceManager nsm = new XmlNamespaceManager(xmlDoc.NameTable);
nsm.AddNamespace("z", "#RowsetSchema");
string fullURL = xmlDoc.SelectSingleNode("z:row", nsm).Attributes["ows_EncodedAbsUrl"].Value;
}
 

No comments:

Post a Comment

Thank you for Commenting Will reply soon ......

Featured Posts

LM Studio is a desktop application designed for developing and experimenting with large language models (LLMs) directly on your computer.

    LM Studio Overview LM Studio is a desktop application designed for developing and experimenting with large language models (LLMs...