Tree View Document Moss Liburutegia 2007

Hi Moss Devs,
Treeview webpart looking for document library zuhaitz ikuspegian bistaratzeko zara.
Ez dago ez koadroan webpart ko eskuragarri dokumentua liburutegia erakutsi Treeview.

Da googling hasi nintzen zeregin honetan lan egiten hasi. I got few webparts which is using java script to load the tree view. I thought of developing own webpart to render the document library in tree view control.

I have created the webpart using .Net 2.0 tree view control and fetching the document library information from the toolpart to render the data to tree view.

Use the following code to load the leaf information of tree view from the document library.

public void TraverseFolder(SPFolder folder,AspControls.TreeNode node)
{
TreeNode tNode = System.Web.UI.WebControls.TreeNode berria(folder.Name);
saiatu
{
bada (folder.Name != “Inprimakiak”)
{
foreach (Folder.SubFolders ere Fldr SPFolder)
{
bada (fldr.Name != “Inprimakiak”)
{
TreeNode TRN = System.Web.UI.WebControls.TreeNode berria(fldr.Name);
tNode = TraverseFiles(Fldr, arantza);
rNode.ChildNodes.Add(tNode);
}
}

foreach (Folder.Files ere SPFILE fitxategia)
{
TreeNode trnChild = System.Web.UI.WebControls.TreeNode berria(file.Name, “”, “~ / _layouts / Images /” + file.IconUrl, file.ServerRelativeUrl.ToString(), “”);
//trv.Nodes.Add(trnChild);
rNode.ChildNodes.Add(tNode);
}
}
}

harrapaketa (Salbuespen e)
{
Console.WriteLine(e.Message);
}
}

TreeNode publiko TraverseFiles(SPFolder Fldr, AspControls.TreeNode node)
{
saiatu
{
foreach (Fldr.Files ere SPFILE fitxategia)
{
AspControls.TreeNode trnChild = System.Web.UI.WebControls.TreeNode berria(file.Name, “”, “~ / _layouts / Images /” + file.IconUrl, file.ServerRelativeUrl.ToString(), “”);
node.ChildNodes.Add(trnChild);
}
bool bRecurseFolders = fldr.SubFolders.Count & gt; 0 ? Egia : faltsua;

bada (bRecurseFolders)
{
egiteko (int i = 0; i < fldr.SubFolders.Count; i++) { TreeNode trnChild = new System.Web.UI.WebControls.TreeNode(fldr.SubFolders[i].Name); node.ChildNodes.Add(TraverseFiles(fldr.SubFolders[i], trnChild)); } } } catch (Exception e) { Console.WriteLine(e.Message); } return node; } Use the Traverse Folder function and pass the root element of the document library as parameter. Now you got a Tree view with appropriate leaf nodes. Render it in your webpart project 🙂

5 comments to Tree View Document Library in MOSS 2007

Iruzkin bat idatzi

Erabil dezakezu HTML tags horiek

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>