【问题标题】:How to get retrieve relevant calendar events through Google Calendar API?如何通过 Google Calendar API 获取相关日历事件?
【发布时间】:2014-03-13 11:25:57
【问题描述】:

我的脚本已经走到了这一步,它只是为了检索特定日历中特定时间段的条目(即,正是我在日历中看到的)。

#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

日历中的所有事件实际上都已被删除(即我在网络界面中看不到任何事件),但结果我继续收到这些事件。

问题,一个答案就足够了:

  1. 结果中是否有一个标志,用于区分已删除和未删除的事件?

  2. 有没有办法一开始就只检索未删除的事件? (查询中的参数 ?showhidden=false 没有帮助)

谢谢!

桑德罗

【问题讨论】:

    标签: powershell google-calendar-api gdata-api


    【解决方案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)
    

    现在我不知道从哪里获得事件的开始和结束时间,但这是另一个问题要回答...

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-06-30
      • 2021-07-04
      • 2013-04-23
      • 2012-10-25
      • 2023-01-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多