Header

Sunday, 14 July 2013

How to get Site, Web, and List name from a list url

How to get Site, Web, and List name from a list url

Some time we have url of list and need to find its web, list name ...

Basically, we need to split string and get web name and list.
 
We have SharPoint to do this in easy way and also dynamic... :)

 Using siteCollection As New SPSite(listurlfromitems)
            Dim Site As SPSite = siteCollection
            Dim myWeb As SPWeb = siteCollection.OpenWeb()
            Dim _list As SPList = myWeb.GetList(listurlfromitems)
End Using

Here listurlfromitems is a string which holds URL of list
after that we can find site, web, and list in Site, myWeb, _list variable

 

No comments:

Post a Comment