ETag Property
Identifier returned by the CalDAV server which is used to synchronize edits.
Syntax
char* GetETag();
int SetETag(char* lpszETag);
Default Value
""
Remarks
This property identifies the state of the event in the calendar. An ETag is returned by the CalDAV server after a successful PutCalendarEvent request. Every time an event is updated, the ETag changes. This gives you the ability to determine if another user has changed the event you added.
You can use this ETag value to maintain a cache. If you submit a GetCalendarReport request with the ReportFilterReturnCalendarData property set to False only the URI and ETags for each event in the calendar will be returned in the report. You can cache the ETag and URI locally, and then inspect the report for any changes and update only the events that have changed ETags.
When updating an event with the PutCalendarEvent method, you may add the ETag to the "If-Match" header (using OtherHeaders)
in order to insure that you are not overwriting more recent changes on the server. For instance:
calDAV.UID = "20110202T000000Z-6414-500-10112-204@nsoftest"; calDAV.StartDate = "20110202T000000Z"; calDAV.EndDate = "20110202T110000Z"; calDAV.TimeStamp = "20100301T000000Z"; calDAV.Summary = "Dinner with friends"; calDAV.Description = "Getting everyone together for some food and fun"; calDAV.Location = "The James Joyce Irish Pub"; calDAV.EventType = CaldavsEventTypes.vEvent; calDAV.OtherHeaders = "If-Match: 1900-1900\r\ n"; calDAV.PutCalendarEvent "https://caldav.calendar.yahoo.com/dav/user_name/Calendar/My_Calendar/20110202T000000Z-6414-500-10112-204@nsoftest.ics"If the current ETag for the above event is "1900-1900", then the above modification will work perfectly. However, if the event was modified on the Yahoo server, the ETag will not match and the above will fail with an HTTP Protocol error: "409 Conflict". In that case you should retrieve the event with GetCalendarEvent and update the most recent version.
This property is filled from the response to a GetCalendarEvent, and is also used when creating an event to be added using the PutCalendarEvent method. However, when requesting a report using the GetCalendarReport method, the contents of this property will only be valid inside the EventDetails event.
Data Type
String