Mti View Document Library katika Moss 2007

Hi Moss Devs,
Mnamtafuta webpart Treeview kuonyesha maktaba hati katika mtazamo mti.
Hakuna nje ya webpart sanduku ya kuonyesha hati maktaba katika Treeview.

Nilianza googling ni wakati ya kuanza kufanya kazi katika kazi hii. I got webparts michache ambayo ni kutumia java script kupakia mtazamo mti. Mimi mawazo ya kuendeleza webpart mwenyewe kutoa hati maktaba katika mti kudhibiti mtazamo.

Mimi tumemuumba webpart kutumia. Net 2.0 mti mtazamo kudhibiti na kuchota maktaba hati taarifa kutoka toolpart kutoa data na maoni ya mti.

Kutumia code zifuatazo kupakia habari majani ya mti maoni kutoka maktaba hati.

umma utupu TraverseFolder(SPFolder folds,AspControls.TreeNode node)
{
TreeNode tNode = mpya System.Web.UI.WebControls.TreeNode(folder.Name);
kujaribu
{
kama (folder.Name != “Fomu za”)
{
foreach (SPFolder FLDR katika folder.SubFolders)
{
kama (fldr.Name != “Fomu za”)
{
TreeNode trn = mpya System.Web.UI.WebControls.TreeNode(fldr.Name);
tNode = TraverseFiles(fldr, trn);
rNode.ChildNodes.Add(tNode);
}
}

foreach (SPFile file katika folder.Files)
{
TreeNode trnChild = mpya System.Web.UI.WebControls.TreeNode(file.Name, “”, “~ / _layouts / / Images” + file.IconUrl, file.ServerRelativeUrl.ToString(), “”);
//trv.Nodes.Add(trnChild);
rNode.ChildNodes.Add(tNode);
}
}
}

catch (Ubaguzi e)
{
Console.WriteLine(e.Message);
}
}

umma TreeNode TraverseFiles(SPFolder FLDR, AspControls.TreeNode node)
{
kujaribu
{
foreach (SPFile file katika fldr.Files)
{
AspControls.TreeNode trnChild = mpya System.Web.UI.WebControls.TreeNode(file.Name, “”, “~ / _layouts / / Images” + file.IconUrl, file.ServerRelativeUrl.ToString(), “”);
node.ChildNodes.Add(trnChild);
}
bool bRecurseFolders = fldr.SubFolders.Count> 0 ? kweli : uongo;

kama (bRecurseFolders)
{
kwa ajili ya (int i = 0; katika < 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 maoni kwa Library Tree View Document katika Moss 2007

BBC

Unaweza kutumia haya HTML

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