码迷,mamicode.com
首页 > Web开发 > 详细

Getting SharePoint objects (spweb, splist, splistitem) from url string

时间:2015-05-29 00:28:26      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:

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 } 

 

Getting SharePoint objects (spweb, splist, splistitem) from url string

标签:

原文地址:http://www.cnblogs.com/huangjianwu/p/4537217.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!