How I upload files to my google drive account with C#.

  Рет қаралды 24,226

DAIMTO Developer Tips

DAIMTO Developer Tips

Күн бұрын

Пікірлер: 88
@DaimtoAps
@DaimtoAps 3 жыл бұрын
You can find my guide for searching for files with the Google drive API V3 kzbin.info/www/bejne/pnmyqJiDZqyfbMU
@KennyomarGarcia
@KennyomarGarcia Жыл бұрын
The only tutorial that actually worked. Thank you!!!
@akashshah1080
@akashshah1080 2 жыл бұрын
Thanks!
@KaisersInGrandRapids
@KaisersInGrandRapids 3 жыл бұрын
Hey Linda - thanks for this and it almost got me all the way there but it seems like you are missing a few critical steps. For anyone else coming along, the File List to get the ID doesn't work since your credentials are the shared users and they can't see the ID of the directory. I tried and all I get back is an empty list since nothing is there. Figured out that I can get that shared directory ID by logging in as me and creating a share link to that directory. In that share url is the directory's ID that you need to strip out.
@DaimtoAps
@DaimtoAps 3 жыл бұрын
This is a very good point thank you, I will remember to address this in future videos. kzbin.info/www/bejne/o2TIpqqOmNqpqNU
@DaimtoAps
@DaimtoAps 3 жыл бұрын
I have created a new video to show how to find the directory file id kzbin.info/www/bejne/o2TIpqqOmNqpqNU hope this helps
@daniborisov5957
@daniborisov5957 2 жыл бұрын
Linda! You are a Legend! Thank you!
@DaimtoAps
@DaimtoAps 2 жыл бұрын
Why thank you. You are to kinda 🙂
@TungNguyen-is1tw
@TungNguyen-is1tw 3 жыл бұрын
Hi Linda. I followed the instructions, but when I checked the drive, I couldn't find the created file. can you help me.
@DaimtoAps
@DaimtoAps 3 жыл бұрын
try doing a file.list i bet the file is being uploaded to the service accounts drive account. Check that you have set parents right.
@hugoforte
@hugoforte 2 жыл бұрын
Thanks for all your great content - it's been super helpful! I've successfully shared a folder on my drive with the service account and it's working great, but when I share it with a folder in our company drive, it doesn't. Any ideas? - The service account is set as a Manager on the company drive (doesn't work) - and as an Editor on my personal company drive (works) The company drive does not have a choice to select editor directly - but managers have full control over the drive.
@DaimtoAps
@DaimtoAps 2 жыл бұрын
by company do you mean workspace account?
@chaddwck
@chaddwck 2 жыл бұрын
whevener i use a service account to upload or create google sheets, I cant remove those files from my main account since the service account is the owner, any idea how to delete files created by a service account?
@DaimtoAps
@DaimtoAps 2 жыл бұрын
use permission insert from Google drive to grant yourself access
@coltonsnyder4698
@coltonsnyder4698 2 жыл бұрын
What reasons might cause the file not to get created? My service account has been given Domain Wide Delegation with the proper scopes yet the file is not getting created in the parent location, root of the service account (verified by use a files.list) and the file is not getting created when impersonating my own account. No errors in the code, no error response, just....nothing. Drive API has been enabled and I see in API Services page under my application, the requests for file.list, file.create and file.permissions are being received yet nothing is actually getting created / updated / changed. Any ideas would be great! Thank you!
@DaimtoAps
@DaimtoAps 2 жыл бұрын
are you adding the parents directory when you upload it?
@coltonsnyder4698
@coltonsnyder4698 2 жыл бұрын
@@DaimtoAps Thank you for the quick followup! I found the issue was that I did not share the drive with the service account. I thought that Domain wide delegation and impersonation would prevent the need to share every folder? I have a large file structure I am working with and sharing each folder with the service account would be very difficult. Additionally, the share option for documents is restricted to our domain only and the service account falls outside of the domain. Any suggestions? Thank you again for the video and followup!
@DaimtoAps
@DaimtoAps 2 жыл бұрын
If you configure deligation in your code the file will be inserted as the user you have deligated as. you won't need to share it then. Pop your code up on stack overflow if you need more help. or email me I have a consulting services would be happy to help you work it out. email is in the information tab
@daswesen123
@daswesen123 2 жыл бұрын
Hi Linda, I followed the really nice toutorial, but I alweays get a HttpClient timeout. Do you know what could cause this?
@DaimtoAps
@DaimtoAps 2 жыл бұрын
nope you shouldn't be getting a timeout. can you put up a question on Stack Overflow? I would love to help
@DaimtoAps
@DaimtoAps 2 жыл бұрын
Spotted your question stackoverflow.com/q/73519213/1841839 Let me know if that doesn't help
@gw671
@gw671 Жыл бұрын
Hello! A question: we get this working when doing it to a shared folder from a user's drive but not when trying to upload to a Shared Drive/Team Drive. Do you know how to do this?
@DaimtoAps
@DaimtoAps Жыл бұрын
I will have to try but shard drive and team drives may require a different approach since they are part of google workspace it may require that the workspace admin set up delegation.
@anatbar-siman-tov515
@anatbar-siman-tov515 Жыл бұрын
Hi, Can I do that with .NET Framework 4.8? c# 7.3? I am getting an error about the 'asynchronous using'.
@DaimtoAps
@DaimtoAps Жыл бұрын
The library still supports it you will just need to work out the code for it.
@ash5me
@ash5me 2 жыл бұрын
I have a doubt, Can I deliver the files uploaded in Google Drive to a doc viewer? Does the file uploaded generates any dynamic url for delivery?
@DaimtoAps
@DaimtoAps 2 жыл бұрын
there is a webdownload url and a WebView url depends on the file type but you need access to the file to use them
@ash5me
@ash5me 2 жыл бұрын
@@DaimtoAps Another question, what's the most fastest way to migrate existing files to Google drive. can I make of use, Google app script in anyway?
@DaimtoAps
@DaimtoAps 2 жыл бұрын
I don't find app script very fast and I think it has limits in place. I should do a test between c#, java, python, php, go and node.js see which google api client uploads fastest 🤣
@ash5me
@ash5me 2 жыл бұрын
@@DaimtoAps Thanks for A2A, appreciate it.
@gredennight
@gredennight 2 жыл бұрын
thanks, given my level of spupidity, it took me only 2 days to understand this guide, 1.5 of which I read about async
@DaimtoAps
@DaimtoAps 2 жыл бұрын
it's not you. authorization can be confusing in the beginning. glad you got it working, let me know if you need help with anything else.
@fernandobonillaviquez6505
@fernandobonillaviquez6505 Жыл бұрын
HI, I have a question, I upload pdf and png files but it can't be open. These method is only for txt format? The error that I have is that The files upload successfully. But when I try to open it, I can't.
@DaimtoAps
@DaimtoAps Жыл бұрын
you need to make sure you supply the correct mime type when you upload it
@fernandobonillaviquez6505
@fernandobonillaviquez6505 Жыл бұрын
@@DaimtoAps Thanks, it works c:
@anatbar-siman-tov515
@anatbar-siman-tov515 Жыл бұрын
@@DaimtoAps I have the same problem with pdf files. The MIME TYPE is set to application/pdf, but the file cannot be open. Should I do anything else?
@DaimtoAps
@DaimtoAps Жыл бұрын
Sounds like you didn't set the correct mime type when you uploaded the file
@anatbar-siman-tov515
@anatbar-siman-tov515 Жыл бұрын
@@DaimtoAps Isn't it the correct one for pdf? (application/pdf)
@grimaldeoliveira3015
@grimaldeoliveira3015 3 жыл бұрын
Hey Linda, tks for this video. i have a doubt about this case, when you upload a file, using a service account, in a shared folder, the quota usage come from the owner of the folder or for the service account?
@DaimtoAps
@DaimtoAps 3 жыл бұрын
Which quota do you mean?
@grimaldeoliveira3015
@grimaldeoliveira3015 3 жыл бұрын
@@DaimtoAps file usage quota
@GirishRajuS
@GirishRajuS 3 жыл бұрын
@@DaimtoAps Could you please answer this question. It is very important. As we know the files uploaded by service account will be stored in its own drive. how to move these files to user drive [My Drive]
@ACertainWebDeveloper
@ACertainWebDeveloper 2 жыл бұрын
How can I select a specific file, It only works when de file it's in the same directory
@DaimtoAps
@DaimtoAps 2 жыл бұрын
Try to specify the full path to the file. The code need to the file in that path on the machine its running on.
@davesmith9600
@davesmith9600 3 жыл бұрын
This is well represented, thanks very much. Just one question please, using this method, isn't the service account now the owner of the uploaded file. If the service account is deleted wouldn't the file disappear?
@DaimtoAps
@DaimtoAps 3 жыл бұрын
Yes it's the owner. I would assume that the file would be deleted if the service account but I have never tried
@hugh_dancy
@hugh_dancy 2 жыл бұрын
dear daimto teacher, thank you so much for this video. your tutorial was able to help me with my issue, i appreciate you so much xoxo
@ashamihhhhhh
@ashamihhhhhh Жыл бұрын
Wowww! Incredible explanation 👏 I have a doubt, what would the code be like to create a folder with the same process of this video? Because I found one, but doesnt work :(
@DaimtoAps
@DaimtoAps Жыл бұрын
Just add the mime type for folder
@ashamihhhhhh
@ashamihhhhhh Жыл бұрын
@@DaimtoAps Really thankss! But how I modificate the code to work from a button? 🥺
@dishakulkarni9579
@dishakulkarni9579 2 жыл бұрын
Hey, I am getting error Severity Code Description Project File Line Error CS0103 The name 'GoogleCredential' does not exist in the current context Upload C:\Users\AVVBVN744\Desktop\C# GDrive\Upload\Upload\Program.cs 16 Even for others like DriveService, BasicClientService etc But I have added the NuGet package . What might be the problem?
@DaimtoAps
@DaimtoAps 2 жыл бұрын
put your code up on stack overflow I will have a look
@rubenedwinhuallaquispe8698
@rubenedwinhuallaquispe8698 3 жыл бұрын
Hi I was wondering if I could use google drive api to upload files from users to my service account drive directly from the browser using REST. Could you give me some lights about it? Thank you
@DaimtoAps
@DaimtoAps 3 жыл бұрын
I dont see any reason why you couldnt. Just remember that you have no control over what the users upload.
@RaquelVargas-l5j
@RaquelVargas-l5j Жыл бұрын
I'm having the next problem: "The service drive has thrown an exception. HttpStatusCode is NotFound. File not found:" and it shows the id of the folder. I thought that the folder doesn't exists. But it does, so I don't know what is the problem. Anyone knows why this is happening?
@DaimtoAps
@DaimtoAps Жыл бұрын
Is it possible that the user you have logged in with does not have access to this file?
@GirishRajuS
@GirishRajuS 3 жыл бұрын
Hi Linda, you mentioned in the video, if we need to change ownership form service account to user account, we need to have domain specific service account. Can you please let us know, how to create domain specific service account?
@DaimtoAps
@DaimtoAps 3 жыл бұрын
you need a google workspace account. I don't have a workspace account yet it my first goal on the patrion page I hope to get a workspace account soon.
@nidhanshusharma1141
@nidhanshusharma1141 2 жыл бұрын
Hey, Thanks for amazing explaination... I had 1 question... Will my user who is uploading the image have to login in order to upload images to my drive...?
@DaimtoAps
@DaimtoAps 2 жыл бұрын
no not when you are using the service account. its been pre-authorized to access your account. No further authorization is required.
@gillescavin8298
@gillescavin8298 3 жыл бұрын
Am I right to think that you need to be a Google Workspace user for this to work?
@DaimtoAps
@DaimtoAps 3 жыл бұрын
not for google drive.
@giorgiamaelaserna6596
@giorgiamaelaserna6596 3 жыл бұрын
Hey Linda, I was wondering if you could expand your storage capacity in your service account? I was having some issues in my service account because my storage is full and I can't find a solution for this. I hope you can help me. Thank you so much!
@DaimtoAps
@DaimtoAps 3 жыл бұрын
As far as i know there is no way to increase the storage size of the service accounts google drive account. thats why its best to have it upload to a normal user drive account then you can request additional access.
@giorgiamaelaserna6596
@giorgiamaelaserna6596 3 жыл бұрын
@@DaimtoAps Alright. Thank you for you response. Your videos helped me a lot. Kuddos to you!
@giorgiamaelaserna6596
@giorgiamaelaserna6596 3 жыл бұрын
@@DaimtoAps Using my Google user account's Client ID and Client Secret, is there a way where I can retrieve Refresh Tokens without User Intervention (consent screen) in C#?
@GirishRajuS
@GirishRajuS 3 жыл бұрын
@@DaimtoAps Please elaborate more on this. Or if you have any videos on this, share with us.
@kevinnatalini5031
@kevinnatalini5031 Жыл бұрын
Thank you for the video!
@khalid_abuhakmeh
@khalid_abuhakmeh 3 жыл бұрын
What IDE are you using?
@DaimtoAps
@DaimtoAps 3 жыл бұрын
The best ide out there for C# actually. Its by this company called JetBrains. They have some amazing helpful devrels to. Its called Rider
@HaiNguyen-wh6gc
@HaiNguyen-wh6gc Жыл бұрын
Thank you very much!
@baseerulhaq9972
@baseerulhaq9972 2 жыл бұрын
Hi Ma'am, Thanks for the tutorial. I'm facing Exception error here which is .. System.IO.FileNotFoundException: 'Could not find file 'C:\Users\Baseer Ul Haq\source epos\FileUploadToGoogleDrive\canvas-antler-337909-42270c3bb620.json'.' . how can I solve it. Thanks
@DaimtoAps
@DaimtoAps 2 жыл бұрын
make sure you set the file to copy always
@natalyverner9316
@natalyverner9316 Жыл бұрын
Thank you so so much!
@caiovinicius4749
@caiovinicius4749 2 жыл бұрын
I have to say, Thank you! 🙏🙏
@DaimtoAps
@DaimtoAps 2 жыл бұрын
glad you got it working 😊
@fadlylado
@fadlylado 3 жыл бұрын
thank you for the tutorial..
@DaimtoAps
@DaimtoAps 3 жыл бұрын
I'm glad it helped 😊
@Aman-x5g
@Aman-x5g Жыл бұрын
Thank that work 👍
@DaimtoAps
@DaimtoAps Жыл бұрын
Happy to help
@sahilsonymayank3019
@sahilsonymayank3019 3 жыл бұрын
Thanks It really works for me
@DaimtoAps
@DaimtoAps 3 жыл бұрын
Welcome 👍
@glebbsif
@glebbsif Жыл бұрын
System.InvalidOperationException: "Error creating credential from JSON or JSON parameters. Unrecognized credential type ."
@DaimtoAps
@DaimtoAps Жыл бұрын
are you still seeing this error?
@anepeva
@anepeva 10 ай бұрын
Hi, thank you forsharing your knowlege. I am seeing this error too.
@dannylin3520
@dannylin3520 8 ай бұрын
The JSON file is in the service account key, not OAuth. Reference video kzbin.info/www/bejne/l6TVdJeNe9d5ZqMsi=lb0gkn1Xqfix3CB0&t=80
Node.js File Upload to Google Drive: A Beginner's Tutorial  #googledriveapi
10:22
How I export files from Google drive with C#.
9:56
DAIMTO Developer Tips
Рет қаралды 10 М.
Google’s Quantum Chip: Did We Just Tap Into Parallel Universes?
9:34
What is Firebase and how to use it
41:01
Firebase
Рет қаралды 573 М.
Automated Google Drive Backups in Python
23:53
NeuralNine
Рет қаралды 26 М.
HTTPS, SSL, TLS & Certificate Authority Explained
43:29
Laith Academy
Рет қаралды 146 М.
How GitHub's Database Self-Destructed in 43 Seconds
12:04
Kevin Fang
Рет қаралды 1 МЛН
Always Check for the Hidden API when Web Scraping
11:50
John Watson Rooney
Рет қаралды 652 М.
The Bridge That Changed the Map of Europe
16:58
The B1M
Рет қаралды 1,2 МЛН
Google OAuth with curl: A Complete Tutorial
17:02
DAIMTO Developer Tips
Рет қаралды 25 М.