Hello all, I was doing an experiment with vbscript and google calendar,
but the result is strange, hope someone with google calendar experience
could give me an answer...

Basically the google authentication part works (first http request),
but when I try to add the event to my calendar (with the second http
request) the server responses me with a state 200 OK (which is fine),
with a truncated content and the event does not appear in my calendar.

Any ideas?

Thank you,

Marco



This is the code (with some msgbox for debugging purpose :-)), you can
cut and paste in a .vbs file

authUrl = "https://www.google.com/accounts/ClientLogin";
email = "[EMAIL PROTECTED]"
passwd = "password"
calendarUrl =
"http://www.google.com/calendar/feeds/default/private/full";
MsgBox "test"
Set objHTTP = CreateObject("Microsoft.XMLHTTP")
objHTTP.open "POST", authUrl, FALSE
MsgBox "open"
objHTTP.setRequestHeader "Content-Type",
"application/x-www-form-urlencoded"
MsgBox "setresponse"
objHTTP.send "Email=" + email + "&Passwd=" + passwd +
"&service=cl&source=Gulp-CalGulp-1.05"
MsgBox "send"
MsgBox objHTTP.status
MsgBox "Headers:" + objHTTP.getAllResponseHeaders()

strAuthTokens = objHTTP.responseText
strAuthTokens = Replace(strAuthTokens, vbCr, "")
strAuthTokens = Replace(strAuthTokens, vbLf, "")
strAuthTokens = Replace(strAuthTokens, vbCrLf, "")
strAuthTokens = Replace(strAuthTokens, "SID", "&SID", 1, 1)
strAuthTokens = Replace(strAuthTokens, "LSID", "&LSID")
strAuthTokens = Replace(strAuthTokens, "Auth", "&Auth")

MsgBox strAuthTokens
strAuthTokens = Right(strAuthTokens,
Len(strAuthTokens)-Len("Auth=")-InStr(strAuthTokens, "Auth=")+1)
MsgBox strAuthTokens

Set objHTTP = Nothing

Set objHTTP = CreateObject("Microsoft.XMLHTTP")
objHTTP.open "POST", calendarUrl, FALSE
objHTTP.setRequestHeader "Content-Type", "application/atom+xml"
objHTTP.setRequestHeader "Authorization", "GoogleLogin auth=" &
strAuthTokens

calendarEntry = "<entry xmlns='http://www.w3.org/2005/Atom'" _
& "xmlns:gd='http://schemas.google.com/g/2005'>" _
& "<category scheme='http://schemas.google.com/g/2005#kind'" _
& "term='http://schemas.google.com/g/2005#event'></category>" _
& "<title type='text'>Tennis with Beth</title>" _
& "<content type='text'>Meet for a quick lesson.</content>" _
& "<author>" _
& "<name>Jo March</name>" _
& "<email>[EMAIL PROTECTED]</email>" _
& "</author>" _
& "<gd:transparency" _
& "value='http://schemas.google.com/g/2005#event.opaque'>" _
& "</gd:transparency>" _
& "<gd:eventStatus" _
& "value='http://schemas.google.com/g/2005#event.confirmed'>" _
& "</gd:eventStatus>" _
& "<gd:where valueString='Rolling Lawn Courts'></gd:where>" _
& "<gd:when startTime='2006-12-12T15:00:00.000Z'" _
& "endTime='2006-12-12T17:00:00.000Z'></gd:when>" _
& "</entry>"

MsgBox calendarEntry

objHTTP.send calendarEntry
MsgBox "send"
MsgBox objHTTP.status
MsgBox "Headers:" + objHTTP.getAllResponseHeaders()

strResponse = objHTTP.responseText

MsgBox strResponse


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Google Calendar Data API" group.
To post to this group, send email to 
[email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-calendar-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to