yup compact framework 2.0

i am not too sure how to access the http response when .net throw up a
webexception object

 Dim updatedURL As String = ""


        Dim feedURL As String =
"http://www.google.com/calendar/feeds/default/private/full";
        Dim encoding As New ASCIIEncoding
        Dim XmL As String = "<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>Andy
greenbaum</name><email>[EMAIL 
PROTECTED]</email></author><gd:transparencyvalue='http://schemas.google.com/g/2005#event.opaque'></gd:transparency><gd:eventStatusvalue='http://schemas.google.com/g/2005#event.confirmed'></gd:eventStatus><gd:where
valueString='Rolling Lawn Courts'></gd:where><gd:when
startTime='2006-08-31T15:00:00.000'endTime='2006-08-31T17:00:00.000'></gd:when></entry>"

        Dim data As Byte() = encoding.GetBytes(XmL)

        Try

            Dim initialpost As HttpWebRequest =
WebRequest.Create(feedURL)
            initialpost.ContentType = "application/atom+xml"
            initialpost.Headers.Add("Authorization: GoogleLogin auth="
& AuthToken)
            initialpost.Method = "POST"
            initialpost.AllowAutoRedirect = False
            initialpost.ContentLength = data.Length


            Dim poststream As Stream = initialpost.GetRequestStream
            poststream.Write(data, 0, data.Length)
            poststream.Close()


            Dim initialresponse As HttpWebResponse =
initialpost.GetResponse()
            updatedURL = initialresponse.Headers.Get("location")
            initialresponse.Close()

        Catch e As WebException

            Dim x As String = e.Message


        End Try

        Try

            Dim SecondRequest As HttpWebRequest =
WebRequest.Create(updatedURL)
            secondrequest.ContentType = "application/atom+xml"
            secondrequest.Headers.Add("Authorization: GoogleLogin
auth=" & AuthToken)
            secondrequest.Method = "POST"
            secondrequest.AllowAutoRedirect = False
            secondrequest.ContentLength = data.Length

            Dim PostStream As Stream = SecondRequest.GetRequestStream()
            PostStream.Write(data, 0, data.Length)
            poststream.Close()

            Dim SecondResponse As HttpWebResponse =
SecondRequest.GetResponse()

            updatedURL = secondresponse.Headers.Get("location")

            secondresponse.Close()


        Catch ez as WebException

            Dim x As String = ez.Message
            x = ez.Response.ToString
            x = ez.StackTrace
            x = ez.Status
            x = ez.Response.ResponseUri.ToString

            Application.Exit()

        End Try


        Return updatedURL


    End Function


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

Reply via email to