Get recently modified\updated list items in Sharepoint
Here are some options that you can use to figure out that .. what all items were recently added, modified or updated in a list or library.
Option 1 -
Create a View in your list or library and in view properties sort in by "modified" descending.Once done you can use this new view in your code to retrieve the newly added list items(top ones).
Option 2 -
Use the SPquery if you want to for e.g. get all the items added today or before your current date and time ( in descending order) so the latest gets on the top.
SPquery - Something like
"<OrderBy><FieldRef Name=\"Modified\" Ascending='False' /></OrderBy><Where><Lt><FieldRef Name=\"Modified\" />
<Value Type=\"DateTime\">"+ DateTime.Now.ToString("yyyy-MM-ddTHH\\:mm\\:ssZ") +"</Value></Lt></Where>"
enjoy!
Option 1 -
Create a View in your list or library and in view properties sort in by "modified" descending.Once done you can use this new view in your code to retrieve the newly added list items(top ones).
Option 2 -
Use the SPquery if you want to for e.g. get all the items added today or before your current date and time ( in descending order) so the latest gets on the top.
SPquery - Something like
"<OrderBy><FieldRef Name=\"Modified\" Ascending='False' /></OrderBy><Where><Lt><FieldRef Name=\"Modified\" />
<Value Type=\"DateTime\">"+ DateTime.Now.ToString("yyyy-MM-ddTHH\\:mm\\:ssZ") +"</Value></Lt></Where>"
enjoy!
0 comments:
Post a Comment