【问题标题】:Google Calender thr VBA, figure out why I am getting event not found errorGoogle Calendar VBA,找出为什么我收到事件未找到错误
【发布时间】:2014-10-14 11:32:23
【问题描述】:

网址 - https://developers.google.com/google-apps/calendar/

我正在使用 Microsfot Internet Transfer Control,我正在尝试发送请求 使用 eventID 而不是 entryID 删除谷歌日历中的事件。

这是我用过的代码,

strURL = "https://www.google.com/accounts/ClientLogin"
strFormData = "Email=" & myEmail & "&Passwd=" & myPassword & "&source=" & mySource & 
"&service=cl"
strHeaders = "Content-Type:application/x-www-form-urlencoded"
Inet1.Execute strURL, "POST", strFormData, strHeaders

'Wait for the server response must include the authentication mode
 Responded = False
 Do Until Responded = True
   DoEvents
 Loop

'Ensure that the password is correct for Google
 If InStr(response, "BadAuthentication") Then    'If the password is not Correct
   MsgBox "Google has rejected the password. Confirm the e-mail and password and try 
   again.", vbCritical, "Error"
   Exit Sub
 End If

'Delete Event  
AuthCode = Right(response, Len(response) - InStrRev(response, "Auth=") - 4)
strURL = "https://www.google.com/calendar/feeds/default/private 
/full/NXZmcjNqM3ZpMnJuaW5hMnVocGM3bWgwbDAgaW50ZWxsaXNvZnR0ZWFtQG0"
strHeaders = "Authorization: GoogleLogin auth=" & AuthCode & _
"Content-Type:application/atom+xml"
Responded = False
Inet1.Execute strURL, "Delete", "", strHeaders

Do Until Responded = True
   DoEvents
Loop

但是,我收到“未找到事件”的响应(HTTP/1.1 404 Not Found), 但我在日历中有事件,事件 ID 是我在 url 中提供的。

我无法弄清楚为什么我会收到 event not found 错误。

【问题讨论】:

    标签: vba google-api google-calendar-api webrequest


    【解决方案1】:

    您不应使用客户端登录,也不应使用 /feeds/ 网址,因为两者都已弃用,后者将于今年 11 月关闭。如果您仍有问题,请迁移到 API v3 并重新发布您的问题。文档位于:https://developers.google.com/google-apps/calendar

    【讨论】:

    • 我们可以在 Access VBA 中使用 Google Calendar API v3 吗?似乎没有办法在 VBA 中使用它。我们需要在 .net 中开发它吗?
    • 下面是VB使用客户端库的示例代码:samples.google-api-dotnet-client.googlecode.com/hg/…
    • 谢谢,但它在 vb.net 中,我正在寻找 Visual Basic for Applications(VBA) 代码示例,可以在 Microsoft Access 中完成。
    猜你喜欢
    • 2015-09-02
    • 2015-09-22
    • 1970-01-01
    • 2021-09-26
    • 1970-01-01
    • 2015-09-06
    • 1970-01-01
    • 1970-01-01
    • 2010-10-03
    相关资源
    最近更新 更多