Here is the one of the simple method to retrieve data from a SharePoint List by user selected view that doesn’t require CAML.
I have given some abstracts here:
// My list name is VerbList
// GUID of the list is F9037F57-6DEB-4BA8-B1BA-85A0995DE882
SPList listName;
DataTable ListDataTable=new DataTable();
SPListItemCollection listItemColl=
listName.GetItems(qry, "{ F9037F57-6DEB-4BA8-B1BA-85A0995DE882}");
ListDataTable =listItemColl.GetDataTable();
In above syntax code lines
listName is object of SPList,where my data is stored.
qry is Query for which data to be displayed.
F9037F57-6DEB-4BA8-B1BA-85A0995DE882 is the GUID of the SPView from where I have to fetch data.
Make sure you use the GUID in Upper Case.
Retrived data will be stored in ListDataTable, you can use the data as you wish.
If you have any questions you can reach out our SharePoint Consulting team here.
By: Nehali
No comments:
Post a Comment