SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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
    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

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.