Sunday, April 5, 2009

SharePoint CAML Query

//Products list should have Price col, and productName col. it gets the data of products which r price >10 and <50 SPWeb web = new SPSite("http://spdevserver:12261/sites/spsite1/").OpenWeb(); SPList list = web.Lists["Products"]; SPQuery query = new SPQuery(); string str = "1050 10 40"; query.Query = str; SPListItemCollection items = list.GetItems(query); foreach (SPListItem item in items) { System.Console.Write(item.DisplayName); System.Console.Write("\n"); }

No comments:

Post a Comment

Followers