Skip to main content
2 of 3
edited tags
Eric Alexander
  • 43.3k
  • 10
  • 54
  • 93

Submitting Recurrence Data with SPService

I'm trying to use SPServices UpdateListItems() to submit events to a custom calendar list.

I can submit normal events correctly but recurring events don't save properly.

 $().SPServices({
            operation: "UpdateListItems",
            async: false,
            batchCmd: command,
            listName: "Events",
            valuepairs: [["Title", $scope.event.title],
                ["EventDate", moment.utc($scope.event.startDate + $scope.event.startTime, "MM-DD-YYYYh:mm A").toISOString()],
                ["EndDate", moment.utc($scope.event.stopDate + $scope.event.stopTime, "MM-DD-YYYYh:mm A").toISOString()],
                ["Location", $scope.event.location ? $scope.event.location.location : ""],
                ["CTPEventInstructor", $scope.event.instructor ? $scope.event.instructor.name : ""],
                ["Description", $scope.event.description ? $scope.event.description : ""],
                ["Category", categorySubmit ? categorySubmit : ""],
                ["EventAllowRegistration", $scope.event.registrationOpen],
                ["EventRegistrationLimit", $scope.event.limit],
                ["EventRegistrationEmail", $scope.event.registerEmail ? $scope.event.registerEmail : ""],
                ["EventWaitingListEmail", $scope.event.waitingEmail ? $scope.event.waitingEmail : ""],
                ["EventChangedEmail", $scope.event.changeEmail ? $scope.event.changeEmail : ""],
                ["EventDeletedEmail", $scope.event.deleteEmail ? $scope.event.deleteEmail : ""],
                ["RecurrenceData", $scope.recurData],
                ["fRecurrence", $scope.event.recurring ? 1 : 0]],
            ID: eventId,
            completefunc: function (xData, status) {     window.history.back(-1);
                }
                else {
                    alert("Unable to submit your request at this time.");
                }
            }});

This saves the event but not as recurring.

I'm sending recurrence the recurrence as a string

"<recurrence><rule><firstDayOfWeek>su</firstDayOfWeek><repeat><daily dayFrequency="2" /></repeat><repeatInstances>10</repeatInstances></rule></recurrence>"

When I view the event I create on the list itself recurrence is listed as

Has anyone ever submitted Recurrence data with SPServices.

I'm also open to using REST API but am hesitant to because you can't retrieve recurrence data with that.