Mapa de sharepoint

28/06/2007 - 10:32 por Iñigo | Informe spam
Muy buenas,
Gracias a la gran pagina de Gustavo he conseguido hacer el mapa de sitios,
con un treeview de Portal / Sitios / Subsitios.
Mi duda es como puedo añadir las paginas:
Portal
Sitio1
Subsitio1
Pagina 1
Pagina 2
Subsitio2
Pagina 1
Sitio2
Pagina 1


Para que salga de esta manera. Os dejo el codigo de nuestro querido Gustavo,
si sabeis como implementar en el codigo que salgan las paginas agradeceria
que me respondierais .
Muchisimas gracias
Un saludo
Iñigo
 

Leer las respuestas

#1 Iñigo
28/06/2007 - 10:34 | Informe spam
using System;
using System.ComponentModel;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.Serialization;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.WebPartPages;
using Microsoft.SharePoint.WebControls;
using Microsoft.Web.UI.WebControls;

/*
* Programado por Gustavo Velez para http://www.gavd.net/servers/
* Puede usar este codigo en cualquier tipo de aplicacion, personal o
comercial.
* Pero no se le olvide hacer una referencia al autor y al sitio en donde lo
encontro.
* Y mandele un E-mail al autor contandole como le parecio
()...
*
*/

namespace TreeViewTest
{
/// <summary>
/// Description for WebPart1.
/// </summary>
[DefaultProperty("Text"),
ToolboxData("<{0}:WebPart1 runat=server></{0}:WebPart1>"),
XmlRoot(Namespace="TreeViewTest")]
public class WebPart1 : Microsoft.SharePoint.WebPartPages.WebPart
{
TreeView myArbol;

protected override void RenderWebPart(HtmlTextWriter output)
{
SPSite mySite = SPControl.GetContextSite(Context);
SPWeb myWeb = mySite.OpenWeb();

TreeNode myRaiz = new TreeNode();
myRaiz.Text = myWeb.Title;
myRaiz.ImageUrl = "/_layouts/images/globe.gif";
myRaiz.Expanded = true;
myArbol.Nodes.Add(myRaiz);

AgregarNudos(myRaiz, myWeb);

myArbol.RenderControl(output);
}

protected override void CreateChildControls()
{
base.CreateChildControls ();
myArbol = new TreeView();
Controls.Add(myArbol);
}

private void AgregarNudos(TreeNode parentNode, SPWeb parentWeb)
{
SPWebCollection myWebs = parentWeb.GetSubwebsForCurrentUser();

foreach(SPWeb mySub in myWebs)
{
TreeNode myNudo = new TreeNode();
myNudo.Text = mySub.Title;
myNudo.ImageUrl = "/_layouts/images/asp16.gif";
myNudo.NavigateUrl = mySub.Url;
myNudo.Target = "";
parentNode.Nodes.Add(myNudo);

//Rutina recursiva
AgregarNudos(myNudo, mySub);
}
}

}
}

Preguntas similares