Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have some Javascript code, that adds events to the Calendar list using Client OM. If a daily event is added, everything is OK. But there're some problems with Weekly events. The event is successfully created, and is visible on the AllItems.aspx page, while they're invisible on the Calendar.aspx page

If I click the Edit Item link on the AllItems.aspx page and, without any changes click Save, event appears on the Calendar.aspx also.

Here's the code:

    var targetList = clientContext.get_web().get_lists().getById(calendarListId);

    var itemCreateInfo = new SP.ListItemCreationInformation();
    this.listItem = targetList.addItem(itemCreateInfo);

    listItem.set_item('Title', eventTitle);
    listItem.set_item('EventDate', eventStart);
    listItem.set_item('EndDate', eventEnd);

    var recData = "<recurrence><rule><firstDayOfWeek>mo</firstDayOfWeek><repeat><weekly mo='TRUE' weekFrequency='1' /></repeat><repeatInstances>5</repeatInstances></rule></recurrence>";
    listItem.set_item('UID', generateGuid());

    //EventType 1 = Recurring Event
    listItem.set_item('EventType', 1);
    //fRecurrence 3 = Weekly Recurrence
    listItem.set_item('fRecurrence', 3);

listItem.set_item('RecurrenceData',recData);                                           
    listItem.update();
    clientContext.load(listItem);

Am I missing any item parameter or xml? When I create daily events, using the code:

listItem.set_item('Title', eventTitle);
listItem.set_item('EventDate', eventStart);
listItem.set_item('EndDate', eventEnd);

recData = "<recurrence><rule><firstDayOfWeek>mo</firstDayOfWeek><repeat><daily dayFrequency='1' /></repeat><repeatInstances>5</repeatInstances></rule></recurrence>";

listItem.set_item('UID', generateGuid());

//EventType 1 = Recurring Event
listItem.set_item('EventType', 1);
//fRecurrence 2 = Daily Recurrence
listItem.set_item('fRecurrence', 2);
listItem.set_item('RecurrenceData',recData);

everything is OK and all added events are displayed on the Calendar.aspx page. Any help is appreciable.

ps Does anybody know where documentation or xml schema to the RecurreceData xml could be found?

share|improve this question

1 Answer 1

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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