2010-01-18 59 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

相關問題