如何在自定义.Net C#应用程序中创建文档库文件夹结构 [英] How to create Document Library folder structure in custom .Net C# application

查看:137
本文介绍了如何在自定义.Net C#应用程序中创建文档库文件夹结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有使用SharePoint 2010开发的文档门户.我计划在自定义.net应用程序中实现相同的文档库文件夹层次结构.我需要实施建议.

I have document portal which has been developed using SharePoint 2010. I have planned to implement the same Document Library folder hierarchy in my custom .net application. I need suggestion to implement. 

我将调用GetListItem()并以XML格式获取文档库的整个结构.这对我来说是来源.现在,我正在寻求开发具有以下文档库功能的自定义应用程序的可行性,

I will call GetListItem() and get the entire structure of document library in XML format. It is source for me. Now i am looking feasibility to develop custom application with same functionality of document library as below,

1.我想在左侧显示文件夹层次结构.

1. I would like to show the folder hierarchy in left side.

2.我想在单击文件夹名称的同时在右侧显示各个文件夹的文档.

2. I would like to show the document of respective folders at right side while click the folder name.

感谢&问候

Poomani Sankaran

Poomani Sankaran

推荐答案

要在左侧显示文件夹层次结构,我们可以使用.NET客户端对象模型从SharePoint文档库中获取所有文件夹,并使用ASP.NET树视图显示数据.

To show the folder hierarchy in left side, we can get all the folders from SharePoint document library using .NET Client Object Model and show the data using ASP.NET treeview.

使用客户端对象模型SharePoint 2010填充树视图

要在右侧显示文件夹的文档,我们可以使用带有CAML查询的CSOM从文件夹中获取文档,并在右侧的gridview中显示文档.

To show the documents of the folder in right side, we can get documents from the folder using CSOM with CAML query and show the documents in a gridview in right side.

CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml = @"<View Scope='RecursiveAll'>
					 <Query>
					 </Query>
				 </View>";
camlQuery.FolderServerRelativeUrl = folder.ServerRelativeUrl;
ListItemCollection listItems = list.GetItems(camlQuery);
clientContext.Load(listItems);
clientContext.ExecuteQuery();

foreach (var item in listItems)
{
 if (item.FileSystemObjectType == FileSystemObjectType.File)
 {
	 // This is a File
 }
 else if (item.FileSystemObjectType == FileSystemObjectType.Folder)
 {
	 // This is a  Folder
 }
}

以树形视图显示文档库文件夹和文件

http://www.c-sharpcorner .com/blogs/display-document-library-folders-and-files-in-tree-view

最好的问候,

丹尼斯


这篇关于如何在自定义.Net C#应用程序中创建文档库文件夹结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆