C# code to get item between from and to dates in sharepoint calendar
 SPList CalendarList = oSPWeb.Lists["Calendar"];
                   DateTime DueDate = Convert.ToDateTime(TextBox1.Text);
                   DateTime ToDate = Convert.ToDateTime(TextBox2.Text);
                   //string DueDate1 = SPUtility.CreateISO8601DateTimeFromSystemDateTime(DueDate);
                   
                    //WORKING 
                  // string query = String.Format(" " + 
                    //                               "{0}  ", SPUtility.CreateISO8601DateTimeFromSystemDateTime(DueDate));
                   string query = String.Format(" " + "" +
                                                       " " +
                                                       "" + SPUtility.CreateISO8601DateTimeFromSystemDateTime(DueDate) + " " +
                                                   " " +
                                                   "" +
                                                       " " +
                                                       "" + SPUtility.CreateISO8601DateTimeFromSystemDateTime(ToDate) + " " +
                                                   " " +
                                                   "   ");
                    SPQuery spQuery = new SPQuery();
                    spQuery.Query = query;
                    //spQuery .ViewFields = string.Concat(
                    //               " ",
                    //               " ",
                    //               " ",
                    //               " ");
                    //spQuery.ViewFieldsOnly = true; // Fetch only the data that we need.
                   SPListItemCollection Calendaritemcol = CalendarList.GetItems(spQuery);
                   int Countitems = Calendaritemcol.Count;
                   if (Countitems > 0)
                   {
                       TextBox1.Text = "Item found" + Countitems.ToString();
                   }
                   else
                   { TextBox1.Text = "Not found"; }
                
                }
Blogs about sharepoint ,Sharepoint Designer,Infopath and powershell
Subscribe to:
Post Comments (Atom)
SPFX - HTTPClient - Curd Operations - SharePoint list.
Create solution in the name of SpfxCrud. ISpfxCrudProps.ts export interface ISpfxCrudProps { description : string ; context : an...
- 
Below code help to identify the SharePoint Online list/library (all) items folder and file. Based on that you can delete the file or folde...
 - 
http://www.projectpoint.at/?p=97 Once that is done, close the form and navigate to the location where you exported yo...
 - 
$now = (Get-Date).AddDays(-1); $lastrun_converted = [microsoft.sharepoint.utilities.sputility]::CreateISO8601DateTimeFromSystemDateTime($...
 
No comments:
Post a Comment