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 need to programmatically add events to a SharePoint Calendar and make them repeatable using JavaScript Client Object Model (without any c# code). Does anybody have ideas how can I implement this using ClientContext js class? Thx.

share|improve this question

2 Answers 2

    var context = new SP.ClientContext.get_current();
    var list = context.get_web().get_lists().getByTitle("Calendar");
    var newEventCreateInfo = new SP.ListItemCreationInformation();
    var newEvent = list.addItem(newEventCreateInfo);
    newEvent.set_item("Location", "Office");
    newEvent.set_item("Start Time", "Start Time of JS Date() type");
    newEvent.set_item("End Time","End Time of JS Date() type");
    newEvent.set_item("Description","Discussion about Calendar JSCOM");
    newEvent.set_item("Title","New Discussion");
    newEvent.set_item("fAllDayEvent",false);
    newEvent.set_item("Category","Discussion");
    newEvent.update();
    context.executeQueryAsync(function(){ alert("Success");},function(){ alert("Failure");})
share|improve this answer

Please see the article for details how to add item to sharepoint list using js Client Object Model - http://www.avanadeblog.com/sharepointasg/2011/05/client-object-model-introduction-part-2-adding-a-list-item.html

share|improve this answer

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.