我(在2014年)制作了一个vb.net应用程序来检索我的所有联系人,它工作正常,现在我想使用该应用程序,但我收到此错误:“执行身份验证请求返回意外结果:404”
这是我正在使用的代码:
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports Google.GData.Client
Imports Google.GData.Extensions
Imports Google.GData.Contacts
Imports Google.Contacts
Imports System.Collections
Imports System.Data
Imports System.Xml
Partial Public Class _Default
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
Dim rs As New RequestSettings("MYAPPNAME", "EMAIL", "PASSWORD")
'Application Name,Username,password
Dim cr As New ContactsRequest(rs)
'Request all contacts
rs.AutoPaging = True
'Allow autopaging
Dim f As Feed(Of Contact) = cr.GetContacts()
'Get all contacts
Dim dt As New DataTable()
Dim dr As DataRow
dt.Columns.Add("Name")
dt.Columns.Add("Phone")
dt.Columns.Add("EmailHome")
dt.Columns.Add("EmailWork")
dt.Columns.Add("EmailOther")
dt.Columns.Add("Birthday")
dt.Columns.Add("Address")
dt.Columns.Add("URL")
dt.Columns.Add("ID")
'Get All Contacts
For Each exi As Contact In f.Entries
dr = dt.NewRow()
Dim n As Name = exi.Name
dr(0) = n.FullName
Dim homeemail As String = ""
Dim workemail As String = ""
Dim otheremail As String = ""
Dim homephone As String = ""
Dim workphone As String = ""
Dim otherphone As String = ""
Dim birth As String = ""
Dim address As String = ""
Dim web As String = ""
Dim contactid As String = ""
'Extract Phone Numbers
For Each ph As PhoneNumber In exi.Phonenumbers
If ph.Other = True Then
If otherphone.Equals("") Then
otherphone += ph.Value
Else
otherphone += ","
otherphone += ph.Value
End If
ElseIf ph.Home = True Then
If homephone.Equals("") Then
homephone += ph.Value
Else
homephone += ","
homephone += ph.Value
End If
Else
If workphone.Equals("") Then
workphone += ph.Value
Else
workphone += ","
workphone += ph.Value
End If
End If
dr(1) = workphone
Next
For Each email As EMail In exi.Emails
If email.Home = True Then
If homeemail.Equals("") Then
homeemail += email.Address
Else
homeemail += ","
homeemail += email.Address
End If
End If
If email.Work = True Then
If workemail.Equals("") Then
workemail += email.Address
Else
workemail += ","
workemail += email.Address
End If
Else
If otheremail.Equals("") Then
otheremail += email.Address
Else
otheremail += ","
otheremail += email.Address
End If
End If
dr(2) = homeemail
dr(3) = workemail
dr(4) = otheremail
Next
Try
birth = exi.ContactEntry.Birthday.ToString
Catch ex As Exception
birth = ""
End Try
dr(5) = birth
For Each adrs As StructuredPostalAddress In exi.PostalAddresses
If adrs.FormattedAddress <> "" Then
If adrs.Equals("") Then
address += adrs.FormattedAddress
Else
address += ","
address += adrs.FormattedAddress
End If
End If
dr(6) = address
Next
For Each wb As Website In exi.ContactEntry.Websites
Try
web = wb.Href
Catch ex As Exception
web = ""
End Try
dr(7) = web
Next
Try
If Len(exi.Id) = 85 Then
contactid = Microsoft.VisualBasic.Right(exi.Id.ToString, 16)
Else
contactid = Microsoft.VisualBasic.Right(exi.Id.ToString, 15)
End If
Catch ex As Exception
contactid = ""
End Try
dr(8) = contactid
dt.Rows.Add(dr)
Next
DataGridView1.DataSource = dt
End Sub
End Class
我现在必须做些什么改变才能让它再次发挥作用?
谢谢大家。