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
http://bsahoo3:2500/sites/Lists/Employees/DispFormASPX
You can see some SharePoint 2013 articles.
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
http://bsahoo3:2500/sites/Lists/Employees/DispFormASPX
You can see some SharePoint 2013 articles.