I am trying to figure out how to configure my DVWP to get all events in a calendar that occur between two days, including recurring. I can't even figure out where to start. Everything I've ready is for SPServices but I want to use a DVWP.
1 Answer
You can use CSOM and SOAP to get events from calendar including recurring event
Go through this method i have created to get all events from calendar.
function GetItemsFromCalendarAsmx () {
wsURL = webUrl + “_vti_bin/Lists.asmx”;
var xmlCall = “<soap:Envelope xmlns:xsi=’http://www.w3.org/2001/XMLSchema-instance’xmlns:xsd=’http://www.w3.org/2001/XMLSchema’xmlns:soap=’http://schemas.xmlsoap.org/soap/envelope/’> <soap:Body>” +
“<GetListItems xmlns=’http://schemas.microsoft.com/sharepoint/soap/’>”+
“<listName>” + calendarGuid + “</listName>” +
“<query>” +
“<Query>” +
“<Where>” +
“<DateRangesOverlap>” +
“<FieldRef Name=\”EventDate\” />” +
“<FieldRef Name=\”EndDate\” />” +
“<FieldRef Name=\”RecurrenceID\” />” +
“<Value Type=’DateTime’><Year/></Value>” +
“</DateRangesOverlap>” +
“</Where>” +
“</Query>” +
“</query>” +
“<queryOptions>” +
“<QueryOptions>” +
“<ExpandRecurrence>TRUE</ExpandRecurrence>” +
“</QueryOptions>” +
“</queryOptions>” +
“</GetListItems>” +
“</soap:Body></soap:Envelope>”;
var result = [];
$.ajax({
url: wsURL,
type: “POST”,
dataType: “xml”,
async: false,
data: xmlCall,
complete: function (xData, status) {
Core.LogMessage(“Core.GetItemsFromCalendarAsmx-> url: ” + wsURL + ” status: ” + status);
if (status === “success”) {
var root = $(xData.responseText);
root.find(“listitems”).children().children().each(function ()
$this = $(this);
var ids = $this.attr(“ows_UniqueId”).split(“;”);
var rec = $this.attr(“ows_fRecurrence”);
result.push({
“StartTime”: $this.attr(“ows_EventDate”),
“EndTime”: $this.attr(“ows_EndDate”),
“Title”: $this.attr(“ows_Title”),
“Recurrence”: (rec === “1” ? true : false),
“Description”: Core.HtmlDecode($this.attr(“ows_Description”)),
“Guid”: ids[1],
“Id”: ids[0],
});
});
}
},
contentType: “text/xml; charset=\”utf-8\””
});
return result;
};