2010-01-18 2 views
0

C#을 사용하여 Sharepoint 2007의 모든 사이트 및 목록에 액세스하려고합니다. 사이트 이름 및 목록을 가져올 수 있습니다. 그러나 특정 목록의 폴더와 하위 폴더를 가져올 수 없습니다. 그리고 특정 폴더에 문서가 업로드되었습니다."목록"에서 생성 된 폴더 및 하위 폴더 목록을 가져 오는 방법은 무엇입니까?

나는이 시도 웹 서비스 (Microsoft.Sharepoint.dll의 종속성)

감사합니다,

Jene

답변

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 (죄송합니다. 게시물에서 언급하지 않았습니다.) 내 코드에서 웹 서비스를 사용하고 있습니다. 해결책을 제시 할 수 있습니까? – Preeti

+0

여기를 참고하십시오 : http://weblogs.asp.net/paulballard/archive/2005/05/08/Using-Data-From-SharePoint-2003-Lists.aspx –

관련 문제