Leabharlann Doiciméad Tree View i CAONAIGH 2007

Hi Moss Devs,
Bhfuil tú ag lorg WebPart Treeview a thaispeáint ar an leabharlann doiciméad i bhfianaise crann.
Níl aon amach as an WebPart bhosca atá ar fáil a thaispeáint ar an leabharlann doiciméad i Treeview.

Thosaigh mé dteagmháil leis an seoltóir é nuair a thosaigh ag obair ar an tasc seo. Fuair ​​mé cúpla webparts atá ag baint úsáide as script java a luchtú an dearcadh crann. Shíl mé ar WebPart féin a fhorbairt i gcóir chun an doiciméad leabharlann i bhfianaise rialú crann.

Chruthaigh mé an WebPart ag baint úsáide as .Net 2.0 rialú dearcadh crann agus an t-eolas leabharlann doiciméad ag fáil ón toolpart i gcóir chun na sonraí atá le dearcadh crann.

Bain úsáid as an cód seo a leanas a luchtú an t-eolas duille de chrainn ón leabharlann doiciméad.

TraverseFolder neamhní poiblí(Fillteán SPFolder,AspControls.TreeNode nód)
{
TreeNode tNode = System.Web.UI.WebControls.TreeNode nua(folder.Name);
déan iarracht
{
más rud é (folder.Name != “Foirmeacha”)
{
foreach (Fldr SPFolder i folder.SubFolders)
{
más rud é (fldr.Name != “Foirmeacha”)
{
TreeNode TRN = System.Web.UI.WebControls.TreeNode nua(fldr.Name);
tNode = TraverseFiles(FLDR, thorn);
rNode.ChildNodes.Add(tNode);
}
}

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

ghabháil (Eisceacht e)
{
Console.WriteLine(e.Message);
}
}

TraverseFiles TreeNode poiblí(SPFolder FLDR, AspControls.TreeNode nód)
{
déan iarracht
{
foreach (Comhad SPFile i fldr.Files)
{
AspControls.TreeNode trnChild = System.Web.UI.WebControls.TreeNode nua(file.Name, “”, “~ / _layouts / Images /” + file.IconUrl, file.ServerRelativeUrl.ToString(), “”);
node.ChildNodes.Add(trnChild);
}
bool bRecurseFolders = fldr.SubFolders.Count & gt; 0 ? fíor : bréagach;

más rud é (bRecurseFolders)
{
le haghaidh (shlánuimhir 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 tuairimí a Tree View Document Leabharlann i MOSS 2007

Fág Freagra

Is féidir leat úsáid a bhaint na clibeanna HTML

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