You basically get anything in the object model with one full url:
1 //here is the site for the url 2 using (SPSite site = new SPSite("http://basesmcdev2/sites/tester1/tester4/A0805051340564172608.txt")) 3 { 4 //here is the web for the url 5 using (SPWeb web = site.OpenWeb()) 6 { 7 //here is the file for the url 8 SPFile file = web.GetFile("http://basesmcdev2/sites/tester1/tester4/A0805051340564172608.txt"); 9 10 //here is the list for the url 11 SPList list = file.Item.ListItems.List; 12 13 //here is the list item for the url 14 SPListItem item = file.Item; 15 } 17 }
时间: 2024-10-24 15:21:35