Some time we have url of list and need to find its web, list name ...
Basically what we do simply split string and get web name and list.This approach will not give us dynamic solution.
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