Connect. Communicate. Collaborate. Securely.

Home » Developer Zone » API/SDK Writers » CALDAV VEVENT filter help (VEVENT filter is returning items outside specified range)
  •  
matt_m is currently offline matt_m

Messages: 2
Karma: 0
Send a private message to this user
I'm using PowerShell to look at an "on call schedule" calendar and enumerate events which occur in the hour. I'm doing this as a scheduled task so I can detect if pager alert assignments need to be updated, based on what appears on the calendar.

here is my query that I'm sending as part of an httpwebrequest to the calendar URL
$event_query = @"
<c:calendar-query xmlns:d='DAV:' xmlns:c='urn:ietf:params:xml:ns:caldav'>
<d:prop>
    <c:calendar-data />
    <d:getetag/>
</d:prop>
<c:filter>
    <c:comp-filter name='VCALENDAR'>
        <c:comp-filter name='VEVENT'>
            <c:time-range start='$utc_start' end='$utc_end'/>
        </c:comp-filter>
    </c:comp-filter>
</c:filter>
</c:calendar-query>
"@


where

$utc_start = "20171216T0100000000000Z"

and

$utc_end = "20171216T0659590000000Z"

I'm using this code to create the UTC time strings:

#create a time window to query the calendar
$today = get-date
$time_start = (get-date -Year $today.Year -Month $today.Month -Day $today.Day -Hour $hour_to_switch -Minute 0 -Second 0 -Millisecond 0).AddDays(0)
$time_end = (get-date -Year $today.Year -Month $today.Month -Day $today.Day -Hour 23 -Minute 59 -Second 59 -Millisecond 0).AddDays(0)
$utc_start = $time_start.ToUniversalTime().ToString("yyyyMMddTHHmmssfffffffZ")
$utc_end = $time_end.ToUniversalTime().ToString("yyyyMMddTHHmmssfffffffZ")


what I thought I should be getting is two VCALENDAR object each with one VEVENT object which fall within the specified 1 hour time period. What I am getting instead is the second VCALENDAR object has a second VEVENT object which doesn't even begin until 2018.

How to I filter out VEVENT objects that aren't within the specified time frame and is this normal behavior or is this a bug? I also just noticed that the second VCALENDAR item was created with the outlook connector.


BEGIN:VCALENDAR
PRODID:-//Kerio Technologies//Kerio Connect//EN
METHOD:PUBLISH
VERSION:2.0
X-VERSION-KMS:6.2.0
X-CALENDARSERVER-ACCESS:PUBLIC
BEGIN:VTIMEZONE
TZID:US/Arizona
BEGIN:STANDARD
DTSTART:19700101T000001
TZOFFSETTO:-0700
TZOFFSETFROM:-0700
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
DTSTAMP:20170828T175736Z
UID:2a724fc7-a6c9-41f9-a279-07aaddd02b16
DTSTART;TZID=US/Arizona:20170406T180000
SUMMARY:(redacted)
DTEND;TZID=US/Arizona:20170413T180000
X-LABEL:0
TRANSP:TRANSPARENT
X-MICROSOFT-CDO-BUSYSTATUS:FREE
PRIORITY:5
RRULE:FREQ=WEEKLY;INTERVAL=3;BYDAY=TH
BEGIN:VALARM
UID:b013dfe9-f6ae-4c2b-b731-e34ec88236d0
TRIGGER;VALUE=DATE-TIME:19760401T005545Z
ACTION:NONE
END:VALARM
END:VEVENT
END:VCALENDAR
</c:calendar-data><a:getetag>f123e1788a3b42ac8705790bdbb9d0220000002500000000</a:getetag></a:prop></a:propstat></a:response><a:response><a:href>/public-calendars/(redacted).com/IT%20Calendar/redacted.eml</a
:href><a:propstat><a:status>HTTP/1.1 200 OK</a:status><a:prop><c:calendar-data>BEGIN:VCALENDAR
PRODID:-//Kerio Technologies//Outlook Connector//EN
METHOD:PUBLISH
VERSION:2.0
X-VERSION-KMS:6.2.0
X-CALENDARSERVER-ACCESS:PUBLIC
BEGIN:VTIMEZONE
TZID:US/Arizona
BEGIN:STANDARD
DTSTART:19700101T000001
TZOFFSETTO:-0700
TZOFFSETFROM:-0700
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
DTSTAMP:20160915T223830Z
UID:160bfaaf-ca3c-4a8d-9f95-38d3edc271b2
PRIORITY:5
SUMMARY:(redacted)
CATEGORIES:Orange Category
TRANSP:TRANSPARENT
X-MICROSOFT-CDO-BUSYSTATUS:FREE
X-LABEL:0
X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
CLASS:PUBLIC
SEQUENCE:0
X-ALARM-TRIGGER:PT00S
DTSTART;TZID=US/Arizona:20170202T180000
DTEND;TZID=US/Arizona:20170209T180000
RRULE:FREQ=WEEKLY;INTERVAL=3;BYDAY=TH
EXDATE;TZID=US/Arizona:20170921T180000
BEGIN:VALARM
UID:43f746b6-0977-4eea-b0b9-471025bd83e1
TRIGGER;VALUE=DATE-TIME:19760401T005545Z
ACTION:NONE
END:VALARM
END:VEVENT
BEGIN:VEVENT
UID:160bfaaf-ca3c-4a8d-9f95-38d3edc271b2
RECURRENCE-ID;TZID=US/Arizona:20180215T180000
DTSTART;TZID=US/Arizona:20180215T180000
DTEND;TZID=US/Arizona:20180222T180000
TRANSP:TRANSPARENT
X-MICROSOFT-CDO-BUSYSTATUS:FREE
X-LABEL:0
SUMMARY:(redacted)
X-ALARM-TRIGGER:PT00S
BEGIN:VALARM
UID:2586245f-7b3d-4640-afa5-4ea7fbc92852
TRIGGER;VALUE=DATE-TIME:19760401T005545Z
ACTION:NONE
END:VALARM
END:VEVENT
END:VCALENDAR

  •  
matt_m is currently offline matt_m

Messages: 2
Karma: 0
Send a private message to this user
Something I noticed is that two of these VEVENT items have the same UID. I'm not sure how it got that way but shouldn't all VEVENTs have unique UIDs?

Maybe that's why nobody else seems to have run across this... I suspect Outlook 2007 with the Outlook Connector has mangled two events to use the same UID. When I deleted the second event sharing the same UID and recreated it, the problem went away.
Previous Topic: Connect: Create User via API
Next Topic: CardDAV: Cannot update VCARD if VCARD was created in custom contacts folder
Goto Forum:
  

 ] [ PDF ]

Disclaimer:
Kerio discussion forums are intended for open communication between forum members and may contain information and material posted by members which may be useful in learning about Kerio products. The discussion forums are not intended to provide technical support for any specific product. Any information implied or expressed in the discussion forums is that of the posting member. Kerio is in no way responsible for the information posted in the forums, or its accuracy. Kerio employees may participate in the discussions, but their postings do not represent an offical position of the company on any issues raised or discussed. Kerio reserves the right to monitor and maintain the forums to promote free and accurate exchange of information.

Current Time: Sun May 20 12:08:00 CEST 2018

Total time taken to generate the page: 1.03904 seconds
.:: Contact :: Home ::.
Powered by: FUDforum 3.0.4.