0

I created a calendar in SP13.
Problem: For recurring events I will like for each event that's recurring to be listed out in the list view. For example. If I created an event to occur every 1st Friday of every month. I would like to see every 1st Friday for every month to be listed individual on the list view. To resolve: I have tried to create the recurring event and add each 1st Friday date for every month as a separate event. This has worked but very time consuming. Does anyone know what I am doing wrong?

3

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.

http://sharepointchan.blogspot.com/2011/10/situation-i-want-to-get-all-calendar.html

More on this link. http://www.nothingbutsharepoint.com/2012/04/26/use-spservices-to-get-recurring-events-as-distinct-items-aspx/

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()
            });
        });
    }
})
1
  • can you tell us more about how/where to use these code?
    – YogaPanda
    Commented Dec 9, 2016 at 23:03

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.