How to find out deletion time of an event with CalDAV? - google-calendar-api

Problem description
I am using CalDAV to sync events between Google Calendar and my own calendar application. Right now i am trying to implement Deletion and Restore functionality:
Every time something is synced between my two systems, i write (meta)info about the synced event in a json file. So using that file i am able to tell in a particular moment which event were synced already and are not anymore present in the CalDAV side (Google Calendar in my current case, but could be any Calendar service that support CalDAV). So, telling if an already-synced event was deleted on the CalDAV side is no problem. Now i would like to know WHEN did the deletion take place.
What i have tried
So far i tried simply retrieving all events with
<?xml version=\"1.0\" encoding=\"utf-8\"?><d:propfind xmlns:d=\"DAV:\" xmlns:cs=\"http://calendarserver.org/ns/\"><d:prop><d:getetag /></d:prop></d:propfind>
But this only returns information about the existing (not deleted) items.
Also i tried retrieving the deleted event using its id with:
<?xml version=\"1.0\" encoding=\"utf-8\"?><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>{eventName}</d:href></c:calendar-multiget>
But this returns HTTP 404.
Does anyone know (or has any suggestion on) how to find out the deletion time of an event using CalDAV?
UPDATE
I found out that using Google Calendar API it is possible to retrieve a list of all the documents, and this list could include deleted ones by setting the property showDeleted to true.
But the question remains:
Does anyone know how could i implement something like this with CalDAV?

Deletion is a peculiarity of Google Calendar, and not necessarily supported by all other calendars, that is why it is not possible to obtain deletion information using just CalDAV.
You could use GoogleCalendar API to take advantage of the deletion information for that particular case while implementing CalDAV in your application: It would be something like Server-Specific functionality.

Related

Metrics and dimensions are not showing up for hits of type 'event'

I have a fully functional and working code (written in C#) which purpose is to track some hits to the specified GA property. This code has been tested and still works successfully. It adds some predefined dimensions (like App Version) to each hit and a several custom metrics to a certain hit types (like event with a certain Event Action).
So far so good everything works flawlessly when taking into account the first property to which these hits are being sent. Also everything is fine when I set up a brand new GA property and track my hits to it - that is, I'm able to see events in Realtime reports, and events show up in custom reports after a while so that I can see my custom metrics.
The issue is that when I try to send absolutely the same hits to the existing property which had been created and configured ages ago - there is no both dimensions (even predefined) and custom metrics in my custom reports. I see these events in realtime and behavior reports, and I'm even able to create a custom report against events count - but that's it. I'm able to use for example Day of the month as a primary dimension, but when I try to use App Version as a dimension or my custom metrics as report metrics - it says "There is no data for this view.".
I've already tried everything I could, have read almost every post about custom definitions in Google and viewed almost each related SO question and answer - still with no luck.
We use measurement protocol
There is a correct User Agent being sent with each hit
17 days has passed since my first attempt to track these hits with existing property
There is no filters and segments at all
There is only one view
For me it looks like a property misconfiguration, but I've inspected each configuration page (I have all possible rights granted) and have not found anything related.
Will appreciate any help with this issue.
UPD: The hit itself (with the sensitive data replaced):
t=event&ec=session&ea=connection_end&el=b225d53a-6bb2-8021-f7b5-ae7004ae0a00&cm1=174960&cm2=1751494&cm3=479033&tid=UA-XXXXXXX-X&cid=4119e77f-be87-4530-04d3-33882f8eea77&v=1&av=XX.XX.99.555&an=my-awesome-app&aid=app.awesome.my
UPD: Here is what I'm trying to achieve (screenshot was made at the test property, where everything works like a charm):

Is there a way - with google scripts - to authomatically check if the note field in a recurring event is empty

We are a non profit association running a library. We use a shared calendar to program the opening hours (and the volunteers who keep the library open). We need a way to be automatically notified (by email best) if a day is with no volunteers. We use the note field for this purpose, so we need to know if for a particular day the note field is empty and in that case a mail should be sent to all the volunteers.
I'm no programmer, just trying with google scrips, but looking at the various examples I found many creating events functions, but no way to check the note field of an event. So before smashing my head I would like to know if that is possible :-)

How to delete orphaned Google Calendars + Events?

My app performs a one-way sync to Google Calendar. As in, if you create an event in my app it will be added to Google Calendar, but you can't update that event from Google Calendar.
I store all the Google Calendar IDs and Event IDs that their API gives me back so that I can update the calendars + events later.
However, I'm concerned about orphaned records. If, for example, someone deletes an event in my app but either the API request fails to delete the corresponding event from Google Calendar or my app has a bug in it, then that record will become orphaned -- it will exist on Google Calendar but I will have no reference to it.
So what's the best way to delete orphaned records?
Here are my ideas:
Download a list of every single event ID in Google Calendar, fetch all the event IDs out of my database, do a set subtraction to determine which ones are orphaned, and then delete those one-by-one.
Delete the entire calendar if I notice a mishap, and then re-sync all the events.
The problem with (1) is that it might get quite memory intensive once I've accumulated a lot of events. The problem with (2) is that a full re-sync can take awhile and those events will be missing from Google Calendar while the sync is happening. Plus, I might have a race-condition if users are creating new events during the sync.
What's the best approach? Are there any other solutions?

Do I have to use queryProfiles every time to get the profile id?

I am playing with Google Analytics API and found that when I get the web property list, I have a defaultProfileId very useful. It can just help me pass the queryProfiles call, to save one request and make the whole app works faster.
But I noticed that some web properties just don't have the defaultProfileId thing.
Just for the information, most of the situations happens to a tracking ID like UA-XXXX-1.
Any tips?
Thanks!
You are correct webProperty does not always return a defaultProfileId. I was also unable to find any information on the Web Properties page as to how the API decides what a Default Profile Id is. I submitted a bug report for it, with the Analytics dev team you can find it at: defaultProfileId - not always sent with a WebProperty. Lets hope they come with a response you are correct this is a very useful feature.
Yes you are probably going to have to query the profiles every time to get the correct profile you are after.
I just found this:
https://www.googleapis.com/analytics/v3/management/accounts/~all/webproperties/~all/profiles?oauth_token={Token}
There should be away of working that to make one request for accounts, one to get all the Web Properties , then one to get all the Profiles.

Copy Event from One Calendar to another

I am creating an app in asp.net for Google calendar integration. When we insert a particular event to the calendar then at the same point i want to copy the same calendar event in to another calendar and i want to do the same process in a single request. So may any one please guide me for this problem. I am using google calendar version 3 for this. Thanks in advance
Is it necessary that they be two separate Calendar events? If not, you should be adding the second calendar as an attendee of the event rather than creating a copy of the event. See the events reference and look for the attendees list attribute. This can be achieved in a single API call.
If it is indeed necessary that the events are entirely separate and independent of each other, it will require two events.insert() operations, one on each calendar. However, as long as the user you are authenticating as has access to both calendars, it should be possible to batch the two operations into a single HTTP call.

Resources