I am trying to work with Google Drive API with vb.net. I have seen a lot of posts,but I am not able to understand how to choose the right folder to add a file.
I have a lot of "Backup" folders but, I assume now, I want to add a file into "Backup" folder under "MyApp1" folder.
I am doing it this way but I don't know how to continue. I search all of my "Backup" folder and I need to check which is under parent folder "Myapp".
Public Shared Function TheRightFolder() As Boolean
Try
Dim FolderName As String = "Backup"
Dim ParentName As String = "MyAPP1"
Dim result As Boolean = False
Dim request = Service.Files.List()
Dim requeststring As String = ("mimeType='application/vnd.google-apps.folder' And trashed=false and title='" & FolderName & "'")
request.Q = requeststring
Dim Parent = request.Execute()
For Each item As File In Parent.Items
'Get PARENT NAME OF THE FOLDER TO CHECK IF I AM INSERT IN MY FILE IN THE RIGHT DIRECTORY (USING 'item.Parents DATA'?)
'...
If ParentName = new_func_to_get_parent_folder_name Then
Return True
End If
Next
Catch EX As Exception
MsgBox("ERROR" & EX.Message)
End Try
Return False
End Function
What am I doing wrong?
Do I need to change way to think to get the right folder?
Thanks in advance!
Found solution:
And: