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...
-
$now = (Get-Date).AddDays(-1); $lastrun_converted = [microsoft.sharepoint.utilities.sputility]::CreateISO8601DateTimeFromSystemDateTime($...
-
<# The below PowerShell script enumerates through all sites with unique permissions and fetches users with Full Control Permission gran...
-
<Sharepoint:SPSecurityTrimmedControl runat="server" Permissions="ManageLists"> add the above code beofre ribbo...
No comments:
Post a Comment