.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Post New Resource Bookmark and Share   

Get records from List Using CAML query by adding days no in Today

Posted By:Sagar Pardeshi       Posted Date: September 12, 2013    Points: 40    Category:    URL: http://www.dotnetspark.com  

Get records from List Using CAML query by adding days no in Today
 

using (SPSite oSite = new SPSite(SPContext.Current.Site.Url))
            {
                using (SPWeb oWeb = oSite.OpenWeb())
                {
                   SPList lstE = oWeb.Lists.TryGetList("MyList");
                    SPQuery qrGeTItem= new SPQuery();
                    string dateStr = Microsoft.SharePoint.Utilities.SPUtility.CreateISO8601DateTimeFromSystemDateTime(DateTime.Today.AddDays(2));
                    qrGeTenqrItem.Query = "<Where><Eq><FieldRef Name='ExpectedDate' IncludeTimeValue='FALSE' /><Value Type='DateTime'>" + dateStr + "</Value></Eq></Where>";
                    SPListItemCollection colItems = lstE.GetItems(qrGeTItem);

                   }
}


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend