How to get relevant calendar events via Google Calendar API?

I went this far with my script, which just has to retrieve entries for a specific calendar over a specific period of time (i.e. exactly what I see on the calendar).

#Powershell

ls (join-path $Script:scriptpath .\GDataCmdLet-master\Binaries\*.dll) | % {
    [System.Reflection.Assembly]::LoadFile($_) 
}

$service=new-object Google.GData.Calendar.CalendarService('Test')
$cred = New-Object Google.GData.Client.GDataCredentials('joe@gmail.com', '1234')

$service.credentials=$cred

$eventquery=new-object Google.GData.Calendar.EventQuery
$eventquery.uri='http://www.google.com/calendar/feeds/joe@gmail.com/private/full'
$eventquery.StartDate = (Get-Date -Date '2014-02-10')
$eventquery.EndDate = (get-date -date '2014-02-20')

$eventfeed=$service.query($eventquery)

DLL that I got from https://github.com/robertj/GDataCmdLet

All events from the calendar were actually deleted (i.e. I do not see any in the web interface), but I continue to receive them as a result.

Questions, an answer to one of them will be enough:

  • Is there a flag in the results that distinguishes deleted from non-deleted events?

  • Is there a way to get only not deleted events in the first place? (the parameter? showhidden = false in the request did not help)

Thank!

Sandro

+3
source share
1

! , , ,

ls (join-path $Script:scriptpath .\GDataCmdLet-master\Binaries\*.dll) | % { 
    [System.Reflection.Assembly]::LoadFile($_) 
}

$service=new-object Google.GData.Calendar.CalendarService('Test')
$cred = New-Object Google.GData.Client.GDataCredentials('joe@gmail.com', '1234')

$service.credentials=$cred

$eventquery=new-object Google.GData.Calendar.EventQuery
$eventquery.uri='http://www.google.com/calendar/feeds/joe@gmail.com/private/basic'

#don't use StartDate and EndDate this way
#they just didn't have the expected effect
$eventquery.StartTime = (Get-Date -Date '2014-02-10')
$eventquery.EndTime = (get-date -date '2014-02-30')

#that does the trick to get the actual occurences, not just the events
#and it also removed the non-deleted ones
$eventquery.SingleEvents = $true

$eventfeed=$service.query($eventquery)

, , , ...

0

All Articles