I really do not want to use InterOp calls to .Net unless i really have to....
Does anyone have an example of the REST/OAuth2 usage to replace the current code:
Function GooAuthentification(stEmail As String, stPassword As String) As Boolean
Dim stURl As String
Dim stSource As String
Dim stFormData As String
Dim stHeaders As String
stSource = App.CompanyName & "-" & App.EXEName & "-" & App.Major & "." & App.Minor
stFormData = "Email=" & stEmail & "&Passwd=" & stPassword & "&source=" & stSource & "&service=cl"
stHeaders = "Content-Type:application/x-www-form-urlencoded GData-Version: 2.1"
mInet.Execute stURl, "POST", stFormData, stHeaders
bFinAttente = False
Do Until bFinAttente = True
DoEvents
Loop
FrmDebug.txtResponse = "Authentication Response:" & _
vbCrLf & vbCrLf & _
stReponse
If InStr(1, stRetHeader, "200 OK") > 0 Then
stAuthCode = Right(stReponse, Len(stReponse) - InStrRev(stReponse, "Auth=") - 4)
GooAuthentification = True
Else
GooAuthentification = False
End If
End Function
Function GooEnvoi(stCde As String, stURl As String, Optional stFormData As String = "", Optional stETAG As String = "") As Boolean
Dim stHeaders As String
Select Case stCde
Case "DELETE", "PUT"
stHeaders = "Authorization: GoogleLogin auth=" & stAuthCode & _
"Content-Type:application/atom+xml" & vbCrLf & _
"GData-Version: 2.1" & vbCrLf & _
"If-Match: " & stETAG
Case Else
stHeaders = "Authorization: GoogleLogin auth=" & stAuthCode & _
"Content-Type:application/atom+xml" & vbCrLf & _
"GData-Version: 2.1"
End Select
bFinAttente = False
mInet.Execute stURl, stCde, stFormData, stHeaders
Do Until bFinAttente = True
DoEvents
Loop
GooEnvoi = Mid(stRetHeader, 10, 2) = "20" ' ("HTTP/1.1 201 Created" ou "HTTP/1.1 200 OK" )
End Function