• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 230
  • Last Modified:

i want to find newly added 3 items in sharepoint list using object model ?

Hi Experts,

i want to find newly added 3 items in sharepoint list using object model.
0
ramuar1981
Asked:
ramuar1981
1 Solution
 
ramuar1981Author Commented:
i want to display newly added items in sharepoint list.
0
 
ivan_vaguninCommented:
Hi!

You can find new items using SPQuery:

SPList myList = SPContext.Current.Web.Lists["My list"];
SPQuery query = new SPQuery();
query.Query = "<OrderBy><FieldRef Name='Created' Ascending='FALSE' /></OrderBy>";
query.RowLimit = 3;
SPListItemCollection items = myList.GetItems(query);
foreach(SPListItem item in items)
{
    //show item
}
0

Featured Post

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now