kamagra how much to take

Getting Some SharePoint Object URL’s In C#

There have been some questions posted in the SharePoint development newsgroups about how to appropriately get some object URL’s in SharePoint.

Here are some examples:

  1. public string GetListUrl(SPList oList)
  2. {
  3. if (oList.DefaultView == null)
  4. {
  5. return oList.ParentWeb.Url;
  6. }
  7. return (oList.ParentWeb.Url + "/" + oList.DefaultView.Url);
  8. }
  9.  
  10. public string GetWebUrl(SPWeb oWeb)
  11. {
  12. return oWeb.Url;
  13. }
  14.  
  15. private string GetCurRequestUrl()
  16. {
  17. string l_strCurRequest = this.Page.Request.Url.AbsoluteUri;
  18. if (l_strCurRequest.IndexOf("/", 8) >= 0)
  19. {
  20. l_strCurRequest = l_strCurRequest.Substring(0, l_strCurRequest.IndexOf("/", 8));
  21. }
  22. return l_strCurRequest;
  23. }

Pretty simple, but there were some questions about it.

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>