我用我的脚本来做这件事,这个脚本应该在特定时间段内检索特定日历的条目(即我在日历中看到的内容)。
#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)
我从https://github.com/robertj/GDataCmdLet获得的DLL
日历中的所有事件实际上已被删除(即我在网络界面中没有看到任何事件),但我继续得到这些事件。
问题,任何一个问题的答案都足够了:
结果中是否有一个标志,用于区分已删除的事件和未删除的事件?
有没有办法首先只检索未删除的事件? (查询中的参数?showhidden = false没有帮助)
谢谢!
桑德罗
答案 0 :(得分:0)
解决了!以下似乎有效,不确定为什么坚韧
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)
现在我不知道从哪里得到出现的开始和结束时间,但那是另一个要回答的问题......