In this post we will see what are the different ways that we extract the data from the SharePoint List at a higher and this will be the basic for the future posts. List can be a Custom List, Document Library, or Survey.
Following are the different ways of accessing data from a list at a broad level:
1. Using Object Model
2. Using Web Services
3. Using Remote Procedure Calls
SharePoint Object Model
There are rich set of APIs for accessing the SharePoint List. Most of the times we will be using following objects:
A. SPSite -> Represents Site Collection
B. SPWeb -> Represents a Web (which is a sub site)
C. SPList -> Represents a List (Can be a Custom List/Document Library etc)
D. SPListItem -> Represents an Item in a List
Apart from these classes we may be using SPFolder, SPFile, etc classes too.
More info is available @ SharePoint Object Model
Please note that we will be using the SharePoint Object in the custom applications/Web Parts which will be hosting on the Same SharePoint Servers.
The other approach of accessing the data using sharepoint web services.
For example we can use Lists.asmx for accessing the data from a List.
Like this we have lots of web services for accessing the data from SharePoint. You can get list of web services @ List of SharePoint Web Services
Since it is a web service, we can use in any custom applications and it can be hosted on SharePoint Server or any other server.
Using Remote Procedure Calls
From SharePoint 2003, we have one more approach for accesing the sharepoint data using RPC Protocal.
Following is the syntax:
Here we are just providing the method and parameters to query the sharepoint database. For example if we want to access the sharepoint task list we can provide the following URL:
In the url, we are specifying the following parameters:
Method Name: Display -> For fetching the data
Parameter: List -> For providing the List Id (GUID)
Parameter: XMLDATA -> For extracting data in the xml format
Parameter: Query -> To provide list of column names separated by the space. * indicates all the columns.
You can get complete list of commands and their parameters @ URL Protocol
This post is the basics for the upcoming post on Displaying Data in a graphical format as shown below: