Using the latest version of PHP apis from Google (0.60), the code sample from google developer page seems to work except that the 'webViewLink' field is empty/null when using 'print_r($createdFile)' at the end of the function.
The drive.google.com site for my Google Apps domain shows the new folder successfully created with public permissions.
Any ideas?
I wrote a small JavaScript app that lists your public folders. Can you confirm your folder is showing in the list? If it's not showing, it's not shared publicly and thus there's no webViewLink:
https://googledrive.com/host/0B0YvUuHHn3Mna3Rzb19tLTYyOXc/
the page is hosted in Google drive itself so it's being served by Google Drive and accessing Google Drive and for anyone that asks, no, the Universe did not implode :-)
A "few" years later here's a working sample with a service account. I have a G Suite account and in https://admin.google.com/example.com/AdminHome?chromeless=1#OGX:ManageOauthClients I have set my API client to API scope https://www.googleapis.com/auth/drive and then
Do pay attention to the
fields
argument: it does not retrieve anything butid
andname
if you leave it out.As a workaround, if you have folder ID, you can use https://googledrive.com/host/FOLDER_ID_HERE