Ara Tree Dokument Librerija fir MOSS 2007

Hi Moss devs,
Qed tfittex webpart Treeview biex juru l-librerija dokument fid-dawl tas-siġar.
M'hemm l-ebda mill-webpart kaxxa disponibbli biex juru l-librerija dokument Treeview.

I bdew googling meta bdew jaħdmu fuq dan il-kompitu. Sibt webparts ftit li tuża l-iskrittura java biex jgħabbi l-ħsieb siġra. Ħsibt li jiżviluppaw webpart stess biex tirrendi l-librerija dokument fil-kontroll minħabba siġra.

I ħolqu l-webpart jużaw. Net 2.0 fehma siġra kontroll u jġibu l-informazzjoni librerija dokument mill-toolpart biex irendu d-data għall-opinjoni tas-siġar.

Uża l-kodiċi li ġejjin tat-tagħbija l-informazzjoni weraq ta 'opinjoni siġra mill-librerija dokument.

TraverseFolder pubbliku null(SPFolder jingħalaq,AspControls.TreeNode node)
{
TreeNode tNode = ġdid System.Web.UI.WebControls.TreeNode(folder.Name);
jippruvaw
{
jekk (folder.Name != “Formoli”)
{
foreach (FLDR SPFolder fil folder.SubFolders)
{
jekk (fldr.Name != “Formoli”)
{
TreeNode TRN = ġdid System.Web.UI.WebControls.TreeNode(fldr.Name);
tNode = TraverseFiles(fldr, TRN);
rNode.ChildNodes.Add(tNode);
}
}

foreach (Fajl SPFile fil folder.Files)
{
TreeNode trnChild = ġdid System.Web.UI.WebControls.TreeNode(file.Name, “”, “~~~HEAD=NNS / _layouts / Stampi /” + file.IconUrl, file.ServerRelativeUrl.ToString(), “”);
//trv.Nodes.Add(trnChild);
rNode.ChildNodes.Add(tNode);
}
}
}

qabda (Eċċezzjoni e)
{
Console.WriteLine(e.Message);
}
}

pubbliku TraverseFiles TreeNode(SPFolder FLDR, AspControls.TreeNode node)
{
jippruvaw
{
foreach (Fajl SPFile fil fldr.Files)
{
AspControls.TreeNode trnChild = ġdid System.Web.UI.WebControls.TreeNode(file.Name, “”, “~~~HEAD=NNS / _layouts / Stampi /” + file.IconUrl, file.ServerRelativeUrl.ToString(), “”);
node.ChildNodes.Add(trnChild);
}
bRecurseFolders bool = fldr.SubFolders.Count> 0 ? veru : falza;

jekk (bRecurseFolders)
{
għall (i int = 0; fl < 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 kummenti lill Librerija Tree Dokument Ara fil MOSS 2007

Leave a Reply

Tista 'tuża dawn it-tags HTML

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