kamagra how much to take

Get SPList By URL In C#

There was a question posted in the development newsgroups about how to structure a different SPList return method then the orthodox SPWeb.GetList method out of the Microsoft.SharePoint namespace. Here is one that I use, which has some slight enhancements.

  1. public SPList ReturnListByUrl(string strPath)
  2. {
  3. if (strPath.ToLower().StartsWith("http"))
  4. {
  5. strPath = strPath.Substring(m_oWeb.Url.Length + 1);
  6. if (strPath.ToLower().StartsWith("lists"))
  7. {
  8. strPath = strPath.Substring(6);
  9. }
  10. }
  11. if (strPath.IndexOf("/") > 0)
  12. {
  13. strPath = strPath.Substring(0, strPath.IndexOf("/"));
  14. }
  15. return m_oWeb.Lists[HttpUtility.UrlDecode(strPath)];
  16. }
Share

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>