Thursday, January 10, 2013

How to get Absolute URL of List using SharePoint object model?

In this post we will discuss how to get absoulte URL of a list using SharePoint object model.

You can also check my previous posts on Get 14 hive file path by using SharePoint 2010 object model [Solution here], Add safe controls programmatically in SharePoint 2010 [Solution here] and Add items to SharePoint list using PowerShell [Solution here].

We can use the SPUtility class to retrieve the absolute or full URL of the SharePoint list.
using (SPSite siteCollection = new SPSite("http://bsahoo3:2500/sites/TestSiteCollection/"))
                using (SPWeb web = siteCollection.OpenWeb())
SPList list = Web.Lists["Employees"];

string listUrl = SPUtility.GetFullUrl(site, list.DefaultDisplayFormUrl);
This will return the DisplayForm Url like below


You can see some SharePoint 2013 articles.


  1. packers and movers in india@
    packers and movers in delhi@
    packers and movers in mumbai@
    packers and movers in pune@
    packers amd movers in gurgaon@

  2. An excellent information provided thanks for all the information i must say great efforts made by you. thanks a lot for all the information you provided.
    Packers And Movers Bangalore

  3. Packers and movers in indore@
    Packers and movers in jaipur@
    Packers and movers in thane@
    Packers and movers in varanasi@
    Packers and movers in surat@
    Packers and movers in lucknow@