Is it possible to share a file publicly through Google Drive API

前端 未结 2 642
-上瘾入骨i
-上瘾入骨i 2020-12-28 20:31

I am working on Google drive application which will allow user to create file which must be public.

I could see some example where we can create a file

2条回答
  •  不思量自难忘°
    2020-12-28 21:13

    You can set the Access Control List of the file using the Permissions feed. The documentation is located here:

    https://developers.google.com/drive/v2/reference/permissions

    To make a file public you will need to assign the role reader to the type anyone

    Then, if you want a link to share to people, you can grab the webContentLink URL returned in the File metadata in the API, it will allow any users to download the file. You can also use it to embed the shared file into HTML (for instance images in tags) .

提交回复
热议问题