Hi Guys,

referring to the code below. I managed to login to google calendar,
however, when I try to get a full calendar list, i'm getting a 401 or
not authorized error. Any ideas? Am I missing anything?

btw.. this is in lotusscript.

Sub initialize

        Dim xmlhttp
        Dim userid As String, pw As String
        Dim params As Variant
        Dim head As String
        Dim auth As String
        Dim Responded As Boolean

        WebServer       = "https://www.google.com/accounts/ClientLogin";
        userid                  = Inputbox("Please enter your email:")
        pw                              = Inputbox("Please enter your 
password:")
        params                  = "accountType=HOSTED_OR_GOOGLE&Email=" + 
userid +
"&Passwd=" + pw + "&source=IBM-Lotus-1&service=cl"
'       Msgbox params

        Set xmlhttp     = createobject("MSXML2.ServerXMLHTTP")
        Call xmlhttp.open ("POST", WebServer, False)
        Call xmlhttp.setRequestHeader ("Content-Type", "application/x-www-
form-urlencoded")
        Call xmlhttp.setRequestHeader ("Content-length", Len(params))
        Call xmlhttp.send (params)

        strxml                  = xmlhttp.responseText
        If Instr(strxml, "BadAuthentication") Then
                Msgbox "Google refused authorization. Please check your email
address and password and try again."
                Exit Sub
        End If

'       Msgbox strxml
        auth                            = "GoogleLogin auth=" + 
Trim(Strright(strxml,"Auth="))
'       Msgbox auth

        '=============================================================='
        WebServer       = "http://www.google.com/calendar/feeds/default/
allcalendars/full"
        xmlhttp                 = Null
        Set xmlhttp     = createobject("MSXML2.ServerXMLHTTP")
        Call xmlhttp.open ("GET", WebServer, False, userid, pw)
        Call xmlhttp.setRequestHeader ("Authorization", auth)
        Call xmlhttp.setRequestHeader ("Content-Type", "application/atom
+xml")
        Call xmlhttp.send (Null)

        Do Until xmlhttp.readyState = 4
                Doevents
        Loop

        If xmlhttp.status = 401 Then
                Msgbox "Error"
                Exit Sub
        End If

        strxml                  = xmlhttp.responseText
        Msgbox strxml

End Sub

--~--~---------~--~----~------------~-------~--~----~
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