Home:ALL Converter>Python Goole Drive API Disable Link Sharing & "Advanced Permissions"

Python Goole Drive API Disable Link Sharing & "Advanced Permissions"

Ask Time:2018-06-08T22:08:26         Author:JDashney

Json Formatter

Can someone please tell me if it is possible to do the following, and if so, point me in the right direction please:

TLDR: When I share the folder to a specific "user" as a "reader" I don't want link sharing to be turned on but it is. "Anyone at My_Org who has the link can view"

I have dug through the docs and posts and cannot find how to do it.

Code Below.

I am creating folders with:

def createFolder(name,sharewith):
    file_metadata = {
    'name': name,
    'parents': ['----------------------------------------'],
    'mimeType': 'application/vnd.google-apps.folder'

    file = service.files().create(body=file_metadata,

    fid = file.get('id')
    return fid

Then Sharing the folder with a specific individual:

def insert_permission(service, file_id, emailAddress, perm_type, role, notif):
  new_permission = {
      'emailAddress': emailAddress,
      'type': perm_type,
      'role': role
    return service.permissions().create(

    except errors.HttpError as error:
        print('An error occurred: %s' % error)
    return None

Edit: I see this - newPermission.setType("anyone"); in Set file sharing level to 'Anyone with the link' through Google Drive API

I want to do the opposite but can't find the acceptable parameters for setType()

Author:JDashney,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/50762489/python-goole-drive-api-disable-link-sharing-advanced-permissions