I need to extract the data from a SharePoint List and view it in a GridView ASP control or any other data table control, how to use the SharePoint API to extract the items from the SharePiont list and demonstrated in a ASP control
A:
There are 2 options:
- Using the SharePoint object model, but that is only useable if you are on the same server as sharepoint is. Generally you would use the SPList object's GetItems method, which takes an SPQuery, that in turn uses a CAML query to specify exactly which items you want returned, i.e. akin to a SQL SELECT statement. for more info check out the SPList.GetItems(SPquery) article on MSDN
- The other option is to use the Lists.asmx Web Service to query a list. The web service can be called from another machine. For more info check the MSDN article
Colin
2009-11-05 18:01:45