Quantcast
Channel: Developing Apps for SharePoint 2013 forum
Viewing all articles
Browse latest Browse all 8089

Recurring Events not gets all data in a given month in C#

$
0
0

Help me about this. I cannot get all the records of recurring events in Calendar. Even using <Month> ,<Year>. it doesn't give the all records. that happens when adding no end date of recurrence.

ex. i want to filter all records on the 10-01-2018 by its month but it appears like in different result range of date. cause i've tried creating an event in calendar with recurrence of Daily weekday=true and no end date. then i don't why it doesn't give the correct result and just tried this date as sample. 

here's the image of what trying to get:

https://social.msdn.microsoft.com/Forums/getfile/621163

here's the data showing when getting it.

http://community.office365.com/cfs-file.ashx/__key/communityserver-discussions-components-files/154/0841.img.jpg

Here's the code:

var list = xWeb.Lists.TryGetList("TestCalendar");

var oQueryBookings = new SPQuery();
oQueryBookings.CalendarDate = new DateTime(2018,10 ,1);
oQueryBookings.ExpandRecurrence = true;


SPListItemCollection oCollBookings = null;

string strViewField = "<FieldRef Name='RecurrenceID' />" +
"<FieldRef Name='Duration' />" +
"<FieldRef Name='Title' />" +
"<FieldRef Name='EventDate' />" +
"<FieldRef Name='EndDate' />" +
"<FieldRef Name='Location' />" +
"<FieldRef Name='Category' />" +
"<FieldRef Name='Description' />" +
"<FieldRef Name='fRecurrence' />" +
"<FieldRef Name='RecurrenceData' />" +
"<FieldRef Name='fAllDayEvent' />" +
"<FieldRef Name='TimeZone' />" +
"<FieldRef Name='EventType' />" +
"<FieldRef Name='UID' />" +
"<FieldRef Name='XMLTZone' />" +
"<FieldRef Name='LinkTitle'/>";
oQueryBookings.ViewFields = strViewField;

string strQuery =" <Where>" + 
" <DateRangesOverlap> " + 
" <FieldRef Name=\"EventDate\" /> " + 
" <FieldRef Name=\"EndDate\" /> " + 
" <FieldRef Name=\"RecurrenceID\" /> " + 
" <Value Type=\"DateTime\" IncludeTimeValue=\"TRUE\"> " + 
" <Month /> " + 
" </Value> " + 
" </DateRangesOverlap> " + 
" </Where> " ;

oQueryBookings.Query = strQuery;

oCollBookings = list.GetItems(oQueryBookings);
if (oCollBookings.Count > 0)
{
DataTable objDatatable = new DataTable();
objDatatable = oCollBookings.GetDataTable();
}

 



Viewing all articles
Browse latest Browse all 8089

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>