Author Topic: Google Drive  (Read 212 times)

golijoe

  • Newbie
  • *
  • Posts: 20
  • joe.golibart@howcogroup.com
Google Drive
« on: May 20, 2022, 09:09:14 am »
I'm running version 2020A and it's been awhile since I've last used Win Batch because of job duties change. I want to be able get a list of PDF file on a Google drive so as to compare to another list and I'm not getting anything to show up.

temp=Environment ("TEMP")

AddExtender("WWWSK44I.DLL",0,"WWWSK64I.DLL")
dir = httpGetDir( "https://drive.google.com/drive/folders/1eD_2MwUL_nlSUmh2bOKqwLZzF_Ljdjre", "" )
list = FileItemize(dir)
Message("", list)
exit

 

td

  • Tech Support
  • *****
  • Posts: 4062
    • WinBatch
Re: Google Drive
« Reply #1 on: May 20, 2022, 01:30:33 pm »
You might want to consider spending more time with the Inet extender's documentation. The httpGetDir function does not return a list of a directory's contents.  The Google Drive REST API documentation might be an excellent place to learn what headers and fields need to be included in an HTTP GET verb to get a file listing. 
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

golijoe

  • Newbie
  • *
  • Posts: 20
  • joe.golibart@howcogroup.com
Re: Google Drive
« Reply #2 on: May 24, 2022, 11:25:29 am »
I could not find a way around it so I just have to select all the files in the Google drive and create a short cut to my drive. Then I can run my script but it's one step I wish I didn't have to do but it works for now. 

td

  • Tech Support
  • *****
  • Posts: 4062
    • WinBatch
Re: Google Drive
« Reply #3 on: May 25, 2022, 07:05:02 am »
I don't have Google Drive on any system nor intend to install it so I can't provide you with an example. However, here is a link to the REST APIs for Google Drive in case you haven't looked at them yet:

https://developers.google.com/drive/api/v3/reference/

The biggest concern would be performing authentication via the OAuth 2.0  protocol. IIRC, OAuth 2.0 support can be found in the dotNet Framework and is therefore supported by WinBatch CLR hosting. You may or may not need to perform authentication depending on whether or not Google APIs pick up on an existing connection.

Not much help but perhaps a starting point for further investigation.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

golijoe

  • Newbie
  • *
  • Posts: 20
  • joe.golibart@howcogroup.com
Re: Google Drive
« Reply #4 on: May 25, 2022, 08:41:23 am »
Thanks I will look into it when I get a chance. I appreciate your help.

stanl

  • Pundit
  • *****
  • Posts: 1633
Re: Google Drive
« Reply #5 on: May 25, 2022, 10:19:05 am »
Just run a simple one-liner Rest Request with Powershell. If it works, then WB can probably do it.

ChuckC

  • Sr. Member
  • ****
  • Posts: 390
Re: Google Drive
« Reply #6 on: May 26, 2022, 10:01:46 am »
As mentioned in previous posts, if you can do it in PowerShell, you can most likely make it work in WinBatch, too.

A Google search for "google drive rest api example powershell" turned some decent reading:

http://rest-examples.chilkat.io/google_drive/powershell/default.cshtml

https://www.example-code.com/powershell/googleDrive.asp

https://www.connorcg.com/uploading-and-downloading-from-google-drive-via-api-with-powershell-and-oauth2.html


stanl

  • Pundit
  • *****
  • Posts: 1633
Re: Google Drive
« Reply #7 on: May 27, 2022, 02:34:15 am »

stanl

  • Pundit
  • *****
  • Posts: 1633
Re: Google Drive
« Reply #8 on: May 29, 2022, 10:03:52 am »
OAuth 2.0 support can be found in the dotNet Framework and is therefore supported by WinBatch CLR hosting.


Tony;  as a thread like this opens up several new avenues, would appreciate any insight on where the Web is going with Oauth 2.0?