2010-01-18 60 views

回答

0

试试这个:

using(SPSite site = new SPSite("http://yoursite")) 
using(SPWeb web = site.OpenWeb()) 
{ 
    SPList list = web.Lists["your_doclib"]; 
    SPQuery query = new SPQuery() 
    { 
     Query = "", 
     ViewAttributes = @"Scope=""RecursiveAll""" 
    }; 
    SPListItemCollection itens = list.GetItems(query); 
    foreach (SPListItem item in itens) 
    { 
     Console.ForegroundColor = 
      item.FileSystemObjectType == SPFileSystemObjectType.Folder ? 
       ConsoleColor.White : ConsoleColor.Gray; 
     Console.WriteLine("{0}", item.Name); 
    } 
} 
+0

感谢名单鲁本斯,但我没有使用Microsoft.Sharepoint.dll(对不起,我没有在之前提到过)。 我在我的代码中使用Web服务。你可以给解决方案吗? – Preeti 2010-01-19 05:17:02

+0

看看这里:http://weblogs.asp.net/paulballard/archive/2005/05/08/Using-Data-From-SharePoint-2003-Lists.aspx – 2010-01-19 08:11:04

相关问题