Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/04/2010, 06:13
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
Recorrer toda una biblioteca de documentos con C#

Hola amigos foreros, necesito recorrer una Biblioteca de documentos en sharepoint y poder cambiarle de valor una columna (que es booleana) en TRUE para toda la biblioteca.

Tengo echo algo pero me da un error: "El elemento Web "RecorreyMuestra" parece estar causando un problema. Actualmente, las actualizaciones no están permitidas en las solicitudes GET. Para permitir actualizaciones en GET, establezca la propiedad 'AllowUnsafeUpdates' en SPWeb."

El codigo que tengo hasta ahora es:

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.  
  37.                 oListItem["procesado"] = true;
  38.                 oListItem.Update();
  39.                
  40.                
  41.             }
  42.             oSiteCollection.AllowUnsafeUpdates = false;
  43.          
  44.  
  45.  
  46.  
  47.         }
  48.    
  49.     }
  50. }
Si alguien me puede dar una mano, agradeceria.