0
我正在尝试使用c#从Sharepoint 2007访问所有网站和列表的列表。 我能够获取网站和列表的名称。 但无法获取特定列表的文件夹和子文件夹。 并将文件上传到特定文件夹中。如何获取在“列表”中创建的文件夹和子文件夹的列表?
我使用的Web服务(无Microsoft.SharePoint.dll的依赖性)
问候,
Jene
我正在尝试使用c#从Sharepoint 2007访问所有网站和列表的列表。 我能够获取网站和列表的名称。 但无法获取特定列表的文件夹和子文件夹。 并将文件上传到特定文件夹中。如何获取在“列表”中创建的文件夹和子文件夹的列表?
我使用的Web服务(无Microsoft.SharePoint.dll的依赖性)
问候,
Jene
试试这个:
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);
}
}
感谢名单鲁本斯,但我没有使用Microsoft.Sharepoint.dll(对不起,我没有在之前提到过)。 我在我的代码中使用Web服务。你可以给解决方案吗? – Preeti 2010-01-19 05:17:02
看看这里:http://weblogs.asp.net/paulballard/archive/2005/05/08/Using-Data-From-SharePoint-2003-Lists.aspx – 2010-01-19 08:11:04