/// <summary> /// Returns the CalDavElement from server with the provided relative url on the server. /// </summary> /// <param name="url">Relative Url to concrete .ics.</param> /// <returns>Found CalDavElement.</returns> private CalDavElement GetSingleItemFromServer(String url) { WebHeaderCollection headers = new WebHeaderCollection(); headers.Add("Depth", "1"); headers.Add("Prefer", "return-minimal"); XmlDocument ResponseXmlDoc; String query = "<c:calendar-multiget xmlns:d=\"DAV:\" xmlns:c=\"urn:ietf:params:xml:ns:caldav\">" + "<d:prop>" + "<d:getetag />" + "<c:calendar-data />" + "</d:prop>" + "<d:href>" + url + "</d:href>" + "</c:calendar-multiget>"; ResponseXmlDoc = this.QueryCaldavServer("REPORT", headers, query, "application/xml", null); List <CalDavElement> responseListCalDav = XmlCalDavParser.Parse(ResponseXmlDoc); return(responseListCalDav.First()); }
/// <summary> /// Returns all CalDavElements from server with full details. /// </summary> /// <returns>List with all CalDavElements with full details.</returns> private List <CalDavElement> GetAllItemsFromServer() { WebHeaderCollection headers = new WebHeaderCollection(); headers.Add("Depth", "1"); headers.Add("Prefer", "return-minimal"); XmlDocument ResponseXmlDoc; string query = "<c:calendar-query xmlns:d=\"DAV:\" xmlns:c=\"urn:ietf:params:xml:ns:caldav\">" + "<d:prop>" + "<d:getetag />" + "<c:calendar-data />" + "</d:prop>" + "<c:filter>" + "<c:comp-filter name=\"VCALENDAR\">" + " <c:comp-filter name=\"VEVENT\" />" + "</c:comp-filter>" + "</c:filter>" + "</c:calendar-query>"; ResponseXmlDoc = this.QueryCaldavServer("REPORT", headers, query, "application/xml", null); List <CalDavElement> responseListCalDav = XmlCalDavParser.Parse(ResponseXmlDoc); return(responseListCalDav); }