This article will describe how you can get the list of your documents from one drive. You can use multiple frameworks but I will use them. NET.
So, all you have to do is follow these steps.
First of all, we need to register our Application to Google Drive and for that, we need to create a new project on this link. After logging in with your account, you will be asked to agree to the terms and conditions. Click ‘Agree and continue’.
After this, you will be able to enable the API.
You will be presented with the API manager. As you see here, you can mention here what type of credentials you need. It's better not to change these and click on the credentials.
This will take you to the following UI. Click ‘OAuth content screen’.
Here, you will be able to see your email address. You also need to mention the project name, shown to the user. I have selected ‘csharpcorner’. After this, hit save.
Click the credentials again and you will get this window. Click ‘Create credentials’ and then ‘OAuth client ID’.
Select ‘other and add the name ‘Drive API Quickstart’’
After that, you will be presented with the keys. Click OK and you will be able to see your keys. Click on download to download the key.
At this stage, you are done with the ‘settings’ part. Now comes the programming part.
- Create a Console Application project.
- Add Nuget package "Install-Package Google.Apis.Drive.v3".
- Open program. cs and replace the code with the code attached.
- Rename the download key from Google to the client_secret.json and add it to your project, you will see it like this.
Right-click on the file click properties and change 'Copy to Output Directory' to "Copy Always"
Now, run the project and you will be routed to the Browser for authentication.
Once you allow it, you should be able to see your document list in the console.