Ver Mensaje Individual
  #2 (permalink)  
Antiguo 15/04/2010, 06:18
Avatar de martin0341
martin0341
 
Fecha de Ingreso: septiembre-2006
Ubicación: Rosario - Santa Fe
Mensajes: 296
Antigüedad: 17 años, 7 meses
Puntos: 8
Respuesta: Sharepoint Webpart

Quizas esto te sirva...

En vez de poner SPSite oSiteCollection = SPContext.Current.Site; pones el site donde se encuentra la biblioteca de documentos.
Reemplaza gsi por el subsitio y Martin por el nombre de la biblioteca o lista que quieres mostrar.


Código HTML:
Ver original
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls.WebParts;
  7. using Microsoft.SharePoint;
  8. using Microsoft.SharePoint.Utilities;
  9.  
  10.  
  11.  
  12. namespace recorreymuestra
  13. {
  14.  
  15.  
  16.     public class RecorreyMuestra : WebPart
  17.     {
  18.      
  19.         protected override void RenderContents(HtmlTextWriter writer)
  20.         {
  21.             SPSite oSiteCollection = SPContext.Current.Site;
  22.             oSiteCollection.AllowUnsafeUpdates = true;
  23.            
  24.            
  25.             SPList oList = oSiteCollection.AllWebs["gsi"].Lists["Martin"];
  26.             oList.BreakRoleInheritance(false);
  27.            
  28.             SPQuery oQuery = new SPQuery();
  29.             oQuery.Query = "";
  30.             SPListItemCollection collListItems = oList.GetItems(oQuery);
  31.            
  32.             foreach (SPListItem oListItem in collListItems)
  33.             {
  34.                
  35.                
  36.                 writer.Write(SPEncode.HtmlEncode(oListItem["Nombre"].ToString()) + " - ");
  37.                 base.RenderContents(writer);
  38.                 writer.Write(SPEncode.HtmlEncode(oListItem["Nombre"].ToString()) + " - ");
  39.                 base.RenderContents(writer);
  40.                 writer.Write(SPEncode.HtmlEncode(oListItem["correo enviado"].ToString()) + "<BR>");
  41.                 base.RenderContents(writer);
  42.                
  43.  
  44.  
  45.                
  46.                
  47.             }
  48.             oSiteCollection.AllowUnsafeUpdates = false;
  49.          
  50.  
  51.  
  52.  
  53.         }
  54.    
  55.     }
  56. }