• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: How we can change the permissions for editors/writers for not sharing the google docs using google docs API?

Resolved: How we can change the permissions for editors/writers for not sharing the google docs using google docs API?

0
By Isaac Tonny on 17/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I am working on google docs API and google drive API. I am facing one issue while setting the permissions for editors/writers for not able to share the google docs to anyone except for the owner using google docs API.
Can anyone tell me how we can set or change the permissions so that no one can share the google docs to anyone except the owner.I went through this links https://developers.google.com/apps-script/reference/drive/file#isShareableByEditors%28%29 and found one function isShareableByEditors() and https://developers.google.com/drive/api/v3/reference/files in this link I found one more function writersCanShare(). But I am not able to understand How I put this function or set the functions to get my work done.
I want to do it with google API only with PHP language. Any help would be much appreciated.

Answer:

I believe your goal is as follows.
  • You want to make users not share the Google Document, while the user can edit the Google Document.
  • You want to achieve this using googleapis for PHP.

I think that in this case, writersCanShare is required to be false. I think that your direction is correct. So, in order to achieve your goal, how about the following sample script?

Sample script:


This script uses Drive API v3.
  • If an error related to the scope occurs, please include the scope of https://www.googleapis.com/auth/drive.metadata and/or https://www.googleapis.com/auth/drive and please authorize the scopes again. But, if you are required to use https://www.googleapis.com/auth/drive.file, I think that you can use it.

  • When this script is run, the user who is not the owner of Document cannot share the document while the user can edit the document.


Reference:


  • Files: update

If you have better answer, please add a comment about this, thank you!

google-api google-docs-api php
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: How can I write CSS selector(s) that apply to table rows for all td elements on that row after a td with a certain class?

01/04/2023

Resolved: How do I use SetWindowText with Unicode in Win32 using PowerShell?

01/04/2023

Resolved: Shopware 400 Status Error “This value is too long. It should have 255 character or less.” When I Try Updating Database Table

01/04/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.