0

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 1

0

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&#8217;xmlns:xsd=’http://www.w3.org/2001/XMLSchema&#8217;xmlns:soap=’http://schemas.xmlsoap.org/soap/envelope/’&gt; <soap:Body>” +
      “<GetListItems xmlns=’http://schemas.microsoft.com/sharepoint/soap/’>&#8221;+
      “<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;
    };
1
  • I need this in a DVWP so CSOM won't work. Commented Aug 28, 2015 at 4:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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