But how to achieve the same thing in Code, Getting a list looping it and filtering the result will do. But sure performance will go down.
Here comes the CAML query for the rescue of SharePoint developer. CAML is having a
So we can write a code snippet as follows to get items created by the current user.
SPList sList=[Get the list to query here];
SPQuery query = new SPQuery();
query.Query = string.Format(
+ "[FieldRef Name='Author' LookupID='TRUE'/]"
+ "[Value Type='User'][UserID /][/Value]"
SPListItemCollection listItems = sList.GetItems(query);
you will get the list items only created by the current user, no iteration, no filteration happens only clean CAML query.
Replace all square brackets[ ] with angle brackets < >. Blogger refused to accept the angle brackets.