如何在Google驱动器VB.NET中的特定文件夹中插入文件 [英] How to insert a file in specific folder in Google drive VB.NET

查看:79
本文介绍了如何在Google驱动器VB.NET中的特定文件夹中插入文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上,我在vb.net中开发了一个应用程序。

第一步,我想在google驱动器中创建一个文件夹和子文件夹(当然我需要测试是否存在文件夹) ),然后,我想上传谷歌驱动程序中特定文件夹中的文件



这里是我的代码



Actually , i develop an application in vb.net .
The first step , i want to create a folder and subfolder in google drive (of course i need a test if a folder exist or not ) , then , i want to upload a file in specific folder in google driver

here is my code

Public Sub createfolder()

    Dim dossier = New Google.Apis.Drive.v2.Data.File()

    dossier.Title = dat_sauv.SelectedItem 'title from combobox in forms
    dossier.MimeType = "application/vnd.google-apps.folder"

    Dim rep = Service.Files.Insert(dossier)
    rep.Fields = "id"

    Dim file = rep.Execute()

    'sub folder Creation
    Dim subfolder = New Google.Apis.Drive.v2.Data.File()

    'title from radio button in forms
    If (VT.Checked = True) Then
        subfolder.Title = VT.Text
    ElseIf (vm.Checked = True) Then
        subfolder.Title = VM.Text
    ElseIf (VI.Checked = True) Then
        subfolder.Title = VI.Text
    Else
        subfolder.Title = VF.Text
    End If

    subfolder.MimeType = "application/vnd.google-apps.folder"

    Dim res = Service.Files.Insert(subfolder)
    res.Fields = "id"

    Dim fil = res.Execute()
    dossier.Parents = subfolder

end sub





我的尝试:



i设法创建文件夹,但不是子文件夹

我设法在谷歌驱动器上传文件但不在特定文件夹



What I have tried:

i managed to create the folder , but not the subfolder
and i managed to upload a file in google drive but not in specific folder

推荐答案

看起来你没有通过Par在执行create folder命令之前将文件夹ID添加到子文件夹...
It does not look like you are passing the Parent folder id to the Subfolder before executing the create folder command...


这篇关于如何在Google驱动器VB.NET中的特定文件夹中插入文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆