【发布时间】: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