RobinBobin / react-native-google-drive-api-wrapper

This wrapper facilitates the use of the Google Drive API in React Native projects.
110 stars 43 forks source link

Want to create a folder using this GDrive library and Add files to that folder #74

Closed mimranzulkfal closed 2 years ago

mimranzulkfal commented 2 years ago

Hey @RobinBobin!

I want some help from this team. I want to create a new folder in the root directory in my GDrive and save new files in that folder. Can you share some code snippets for this purpose?

I'll be thankful to you :)

RobinBobin commented 2 years ago

Please have a look at the sample project linked in the readme.

mimranzulkfal commented 2 years ago

@RobinBobin I have gone through that but can't get it specifically for creating a new folder and writing JSON files to that folder.

Kindly tell me about some code snippets. I'll be thankful to you.

RobinBobin commented 2 years ago

https://github.com/RobinBobin/gdrivetest/blob/master/src/Files.tsx

mimranzulkfal commented 2 years ago

I'm creating same as it is but it's not creating a folder on my drive. Have a look: image

RobinBobin commented 2 years ago

Are you sure you don't have this folder already?

RobinBobin commented 2 years ago

Is an exception thrown?

mimranzulkfal commented 2 years ago

I have no folder with this name on the drive. Also there is no exception thrown.

RobinBobin commented 2 years ago

Try running my project.

Try listing files to make sure you setup everything correctly.

mimranzulkfal commented 2 years ago

If I use only this part only then folder is creating fine:

googleDrive.files.newMetadataOnlyUploader().setRequestBody({ name: "MyFolder", mimeType: MimeTypes.FOLDER, parents: ["root"], })

But it'll create a new folder with same name everytime.

RobinBobin commented 2 years ago

What will happen if you run my project and press the corresponding button?

mimranzulkfal commented 2 years ago

Hey Robin!

I have created a folder but now how please check I'm passing folderID right or not? My newly created folder name is condition_folder.

I'm doing in this way but file isn't uploading.

image

RobinBobin commented 2 years ago

Please consult official google drive docs as for parents. I think you're setting it wrong. I'm pretty sure you'll find something interesting in the thrown exception. Why are you pasting screenshots with your code? Imagine someone wants to copy paste it to run.