Var googleDriveApiKey = "Your Google Drive API key" Var publicFolderId = "4wj98k3bbQsLRuiWm-PrQlRfkrEP6lbNg" In my code sample I just print out the id and name of each file in the folder. The resulting JSON object has an array of files each of which has an id and name as well as a kind (which is usually drive#file) and a mimeType. The results are paged, so we need to keep calling it until we no longer get a next page token. We can do that with a call to the /drive/v3/files endpoint, passing in a query for any files that have the folder id as one of their parents. Let's see some code to list the files in the folder. Usually you'll receive a sharing URL that looks something like this, with the folder id as part of the URL: Now we need the folder id of the Google Drive folder that's been shared with you. Obviously you should avoid exposing this key to the end users of your application. You can generate one for use with your application at the Google Developer Console. There is a Google Drive API we can use for this purpose, but first we need an API key. Closely related to my recent post about how to list and download the contents of a GitHub repo in C#, I also wanted to be able to list the files in a publicly shared Google Drive folder and download them from C#.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |