3

I am working on SharePoint 2013 on-premise environment.

We have calendar list with recurring events. These events shown in Calendar view and All events view without any issues.

We created one data view webpart for this calendar on a page. In this calendar data view webpart general events(which are not recurring) showing on page with out any issues but recurring events are not showing.

Example: I have an recurrence event on Friday it should occurred on every Friday throughout the year. These recurring event showing in list calendar view without any issues but not showing in data view webpart calendar on a page.

Consider 22nd September is Friday, 29th September is Friday, 6th October is Friday ..etc... (Friday recurring event)

These events are not showing on data view webpart calendar page. But when i open and edit and save the 22nd September Friday event without do any changes in Calendar list, then only that event(22nd September Friday) showing on page but haven't showing other Fridays recurring events.

This is the issue. Please let me know if any have on idea on this. Thanks in advance.

1 Answer 1

1

If you like to display calendar items in List view (content query web part), you need to use sp.js for recurring events.

SharePoint: CAML get all calendar items from including recurring items

More on this link. USE SPSERVICES TO GET RECURRING EVENTS AS DISTINCT ITEMS

var startDate = "2012-05-12T12:00:00Z"; // Our example will show the month of May 2012
$().SPServices({
   operation: "GetListItems",
   async: false,
   listName: "My Calendar",
   CAMLViewFields: "<ViewFields>" +
        "<FieldRef Name='Title' />" +
        "<FieldRef Name='EventDate' />" +
        "<FieldRef Name='EndDate' />" +
        "<FieldRef Name='Location' />" +
        "<FieldRef Name='Description' />" +
        "<FieldRef Name='fRecurrence' />" +
        "<FieldRef Name='RecurrenceData' />" +
        "<FieldRef Name='fAllDayEvent' />" +
    "</ViewFields>",
CAMLQuery: "<Query>" +
        "<Where>" +
            "<DateRangesOverlap>" +
                "<FieldRef Name='EventDate' />" +
                "<FieldRef Name='EndDate' />" +
                "<FieldRef Name='RecurrenceID' />" +
                "<Value Type='DateTime'>" +
                    "<Month />" +
                "</Value>" +
            "</DateRangesOverlap>" +
        "</Where>" +
        "<OrderBy>" +
            "<FieldRef Name='EventDate' />" +
        "</OrderBy>" +
    "</Query>",
CAMLQueryOptions: "<QueryOptions>" +
        "<CalendarDate>" + startDate + "</CalendarDate>" +
        "<RecurrencePatternXMLVersion>v3</RecurrencePatternXMLVersion>" +
        "<ExpandRecurrence>TRUE</ExpandRecurrence>" +
    "</QueryOptions>",
completefunc: function (xData, Status) {
    $(xData.responseXML).SPFilterNode("z:row").each(function() {
        var $node = $(this),
            fADE = $node.attr("ows_fAllDayEvent") || 0,
            thisADE = (fADE == 0),
            thisID = $node.attr("ows_ID"),
            sepID = thisID.indexOf(';#'),
            thisTitle = $node.attr("ows_Title"),
            thisRecurrence = $node.attr("ows_fRecurrence"),
            thisDesc = $node.attr("ows_Description");
        if (sepID != -1) thisID = thisID.substring(0,sepID);
        var thisUrl = "DispForm.aspx?ID=" + thisID,
            thisClass = thisTitle.replace(" ","").substr(0,10).replace(",","").replace(" ","") + thisID,
            thisRD = $node.attr("ows_RecurrenceData");

        // if working with FullCalendar or building an events object for another purpose...
        events.push({
            title: thisTitle,
            start: $node.attr("ows_EventDate"),
            end: $node.attr("ows_EndDate"),
            allDay: thisADE,
            url: thisUrl,
            description: $(thisDesc).text()
        });
    });
  }
})
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.