2012-11-23 123 views
1

我有一個應用程序在VB.Net誰可以下載和上傳文件在谷歌文檔。 但現在谷歌文檔變成谷歌驅動器。VB.Net和谷歌驅動器sdk

我使用此代碼連接到我的帳戶。


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中的代碼,如this。 請幫幫我。

回答

0

您的代碼仍然有效。文檔列表API不會停止,並會訪問您在Google雲端硬盤上的文件。

我不知道在VB中是否存在Drive API的實現,如果您確實想要使用Drive API,您可能需要手動構建HTTP請求