Beside query string root folder
how do i get the current doc library list(ListName) from below example url
http://site/subsite/ListName/Forms/AllItems.aspx
any standard way?
Beside query string root folder
how do i get the current doc library list(ListName) from below example url
http://site/subsite/ListName/Forms/AllItems.aspx
any standard way?
Try this
using (SPSite site = new SPSite("http://site/subsite/ListName/Forms/AllItems.aspx"))
using (SPWeb web = site.OpenWeb()) {
SPList list = web.GetListFromUrl("http://site/subsite/ListName/Forms/AllItems.aspx");
}
SPWeb web = SPContext.Current.Web;
string listname = "Not a list";
try
{
SPList list = web.GetList(HttpContext.Current.Request.RawUrl);
if (null != list)
{
listname = list.Title;
}
}
catch (System.IO.FileNotFoundException) { }
HttpContext.Current.Response.Write(listname);
Has this been resolved? Similar issue. Just trying to get the current document library that user is in now.