

so we will be using the drive scope, to attain full access to the users drive account. Due to the fact that we willīe uploading a file we will need write access to the drive account. We simply load the credentials key file and set which scope we will be using. Ok now we we will need to load the credentials into our application. Private const string PathToServiceAccountKeyFile = service account That we shared with it so we can get the file id we will need to upload our files. To find the directory name here is to do a file.list and it will list all of the files that the service account has access to it will also return the directory So i have added the nameįinally i have a directory id constant which is the file id of the directory on my google drive account which i shared with the service account. In my project i have created a simple text document called Test hello.txt remember to set this file to copy always under its properties. I will need another constant for the service account email address, you can get this from google developer console or you can just open the key file in a text editorĪnd you will find it there its the one that contains an and looks kind of like an email address. The first is the path to the credentials.json file we downloaded from google developer console, as always don’t share your credentials with anyone these shouldīe stored save and secure for only your team to access. Add constantĪt the top of my program class i am going to create a couple of constants. You will need to include the 3 nuget package. Of project you create but for this example we are going to keep it simple and just use a console app. net core console application, but you can use service accounts, with libraries or with asp.

This Tutorial was completely rewritten in April, 2021
