0

Am trying to retrieve an event from a calendar list using ajax. Am able to retrieve all properties of an event except the 'StartDate', which is returning undefined. Both the 'StartDate' and the 'EndDate' fields in the list item have values. Just fyi am a newbie in sharepoint development.

below is my code snippet.

var appWebUrl;
$(document).ready(function (){
    $("#get_event").click(function(){
        $.ajax({
            url: appWebUrl+"/_api/web/lists/getbytitle('Meeting_rooms')/items(1)",
            type:'GET',
            dataType:'JSON',
            success: function(data){
                JSON.stringify(data);
                console.log("Title : "+data.Title);  //returns a value
                console.log("Description : "+data.Description);  //returns a vaue
                console.log("Starting : "+data.StartDate);  // returns undefined
                console.log("Ends on : "+data.EndDate);  //returns a value
            },
            error: function(){
                alert("Shit hit the fan");
            }
        });
    });
0

Even if the UI says StartDate and EndDate the field internal names are different.

You can use the field settings to find out the actual names. Or you can use the browser console to figure out the properties available in the data object.

Try EventDate and EndTime instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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