Google drive api ver3 how share on my web page

2019-09-08 09:41发布

问题:

Can somebody help me? I could add the file to my webPage in version 2 like this (img1): drive.files().get(fileID).execute().getAlternateLink()); How i can do this in ver3 ?? All of this method return null: getWebContentLink ,getWebViewLink,getThumbnailLink 2) How i can get full access auth? Google examples doesn't works img1

回答1:

In Drive v3, to retrieve metadata properties (i.e. WebViewLink, thumbnailLink,emailAddress, etc.), you will only need to specify the individual fields required by the app.

Try something like this (example in Python):

file_id ='XXXXXXXXXXXXXXXXXX'
file = service.files().get(fileId=file_id, fields='webViewLink').execute()
    print 'Title: %s' % file['webViewLink']

Hope this helps. Good luck!