Hi everyone,
I am trying to build an application in VB.net Express Edition that will
read and alter events on a person's Google Calendar. I have followed
many examples and read through quite a few areas of this group but have
hit a wall. It seems that no matter what I do, I cannot get my program
to authenticate itself.
Here is my code:
---------------------------
Imports Google.GData.Calendar
Imports Google.GData.Client
Imports Google.GData.Extensions
...
Dim mSetting As New My.MySettings
Dim strEmail, strPassword, strgURI As String
strEmail = mSetting.GoogleEmail [="[EMAIL PROTECTED]"]
strPassword = mSetting.Password [="PASSWORD"]
strgURI = mSetting.FeedURL
[="http://www.google.com/calendar/feeds/[EMAIL PROTECTED]/private/full"]
'Create FeedQuery and Service object
Dim gQuery As New Google.GData.Calendar.EventQuery
Dim gService As New
Google.GData.Calendar.CalendarService("SeeSpeckCom-GOSync-001")
'Set credentials
gService.setUserCredentials(strEmail, strPassword)
'Create the query object
gQuery.Uri = New Uri(strgURI)
'Tell the service to query
gQuery.StartTime = DateTime.Now.AddDays(2 * 7)
gQuery.EndTime = DateTime.Now.AddMonths(2 * 7)
Dim calFeed As Google.GData.Calendar.EventFeed
Try
calFeed = gService.Query(gQuery)
Catch ex As GDataRequestException
Dim ErrText As String
ErrText = ex.ResponseString
If InStr(ErrText, "Error=CaptchaRequired") Then
If MsgBox("Google has requested that you authenticate
this computer." & vbCrLf & _
"This is to ensure that this program is authorised to
access your account." & vbCrLf & vbCrLf & _
"Would you like to do this now?", MsgBoxStyle.YesNo)
Then
System.Diagnostics.Process.Start("https://www.google.com/accounts/DisplayUnlockCaptcha")
End If
Else
MsgBox("UNKNOWN ERROR" & vbCrLf & vbCrLf & ex.Message &
vbCrLf & ErrText, MsgBoxStyle.Critical)
End If
Exit Sub
End Try
...
--------------------------------------
It will rarely returns the CaptchaRequired error, and on all other
times it will say:
"Execution of authentication request failed"
Error=BadAuthentication"
The results are the same no matter what I put in as user id, calendar
feed & password. I know that the passwords I am putting in are correct.
Any help would be greatly appreciated. Has anyone else managed to make
the API work with VB.net? Am I missing anything in my code?
Thanks in advance,
Chris
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---