This post was most recently updated on July 29th, 2024
In this post, I will show you how to filter the SharePoint list items for the previous week and next week from TaskDate, created by the current user. SharePoint list has the option to filter list from OOB under list view section, In this article, I will show you how can you achieve through using CAML Query as well using SharePoint OOB.
You can filter list items for the previous week and next week from TaskDate, from SharePoint OOB using list filter rule.
Using CAML query we will show the previous week and next week list items from TaskDate column created by the current user and order by ID. You can also filter separately previous week, next week and created by current user items.
I am adding the CAML query for your reference.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
<Query> <OrderBy> <FieldRef Name="ID" /> </OrderBy> <Where> <And> <And> <Eq> <FieldRef Name="Author" /> <Value Type="Integer"> <UserID Type="Integer" /> </Value> </Eq> <Gt> <FieldRef Name="TaskDate" /> <Value Type="DateTime"> <Today OffsetDays="-7" /> </Value> </Gt> </And> <Lt> <FieldRef Name="TaskDate" /> <Value Type="DateTime"> <Today OffsetDays="7" /> </Value> </Lt> </And> </Where> </Query> |
Hope you find it helpful. If you liked this article, then please share and comment.