Mostrando entradas con la etiqueta Read Items SharePoint. Mostrar todas las entradas
Mostrando entradas con la etiqueta Read Items SharePoint. Mostrar todas las entradas

miércoles, 17 de julio de 2013

Read items from a SharePoint 2010 List programmatically

There are many ways to read programmatically items from a Sharepoint List. but in this post see a simple way to read



1. we have a SharePoint list with many elements

2. We will pass through the columna "Title", using the next code


It's is the simple way in SharePoint


Code.


 using System;  
 using System.Web.UI;  
 using System.Web.UI.WebControls;  
 using System.Web.UI.WebControls.WebParts;  
 using Microsoft.SharePoint;  
 namespace ProyectosSharePoint.LeerItems  
 {  
   public partial class LeerItemsUserControl : UserControl  
   {  
     protected void Page_Load(object sender, EventArgs e)  
     {  
       SPWeb Web = SPContext.Current.Web;/// web context  
       SPList List = Web.Lists["ItemsSharePoint"]; ///Name of list  
       foreach (SPItem item in List.Items)  
       {  
         string ItemValue = item["Title"].ToString();///value of the field  
       }  
     }  
   }  
 }  


Regards.
Oscar Miguel Dominguez Acevedo