1

我在 VB.Net 中有一个应用程序,可以在 google doc 上下载和上传文档。但是现在 google doc 变成了 google drive。

我使用此代码连接到我的帐户。


Public Class Form1
    Dim DocServices As DocumentsService

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    logIn()
End Sub

Sub logIn()
    DocServices = New DocumentsService("DocListUploader")
    DocServices.setUserCredentials(txtUserName.Text, txtPassword.Text)

    Dim docQuery As New DocumentsListQuery
    docQuery.NumberToRetrieve = 1
    DocServices.Query(docQuery)
    getDocList()
End Sub



Sub getDocList()
    Me.lbDocs.Items.Clear()
    Dim resultFeed As DocumentsFeed = Me.theFeed()
    Dim entry As New DocumentEntry
    For Each entry In resultFeed.Entries
        Me.lbDocs.Items.Add(entry.Title.Text)
    Next
End Sub

Function theFeed() As DocumentsFeed
    Dim query As New DocumentsListQuery()
    Dim feed As DocumentsFeed = DocServices.Query(query)
    Return feed
End Function

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
        Dim theFilename As String = OpenFileDialog1.FileName
        Dim theEntry As DocumentEntry
        theEntry = DocServices.UploadDocument(theFilename, Nothing)
    End If
End Sub
End Class

我想做同样的想法,但使用谷歌驱动器。我没有像这样在 c# 中找到 vb.net 中的代码。请帮我。

4

1 回答 1

0

您的代码仍然有效。Document List API 不会停止使用,它将访问您在 Google Drive 上的文件。

我不知道VB中是否存在Drive API的实现,如果你真的想使用Drive API,你可能必须手动构建你的HTTP请求

于 2012-11-27T10:58:32.543 回答