Drive API . parents

Instance Methods

delete(fileId, parentId)

Removes a parent from a file.

get(fileId, parentId)

Gets a specific parent reference.

insert(fileId, body, supportsTeamDrives=None, supportsAllDrives=None)

Adds a parent folder for a file.

list(fileId)

Lists a file's parents.

Method Details

delete(fileId, parentId)
Removes a parent from a file.

Args:
  fileId: string, The ID of the file. (required)
  parentId: string, The ID of the parent. (required)
get(fileId, parentId)
Gets a specific parent reference.

Args:
  fileId: string, The ID of the file. (required)
  parentId: string, The ID of the parent. (required)

Returns:
  An object of the form:

    { # A reference to a file's parent.
    "selfLink": "A String", # A link back to this reference.
    "kind": "drive#parentReference", # This is always drive#parentReference.
    "id": "A String", # The ID of the parent.
    "isRoot": True or False, # Whether or not the parent is the root folder.
    "parentLink": "A String", # A link to the parent.
  }
insert(fileId, body, supportsTeamDrives=None, supportsAllDrives=None)
Adds a parent folder for a file.

Args:
  fileId: string, The ID of the file. (required)
  body: object, The request body. (required)
    The object takes the form of:

{ # A reference to a file's parent.
  "selfLink": "A String", # A link back to this reference.
  "kind": "drive#parentReference", # This is always drive#parentReference.
  "id": "A String", # The ID of the parent.
  "isRoot": True or False, # Whether or not the parent is the root folder.
  "parentLink": "A String", # A link to the parent.
}

  supportsTeamDrives: boolean, Deprecated use supportsAllDrives instead.
  supportsAllDrives: boolean, Deprecated - Whether the requesting application supports both My Drives and shared drives. This parameter will only be effective until June 1, 2020. Afterwards all applications are assumed to support shared drives.

Returns:
  An object of the form:

    { # A reference to a file's parent.
    "selfLink": "A String", # A link back to this reference.
    "kind": "drive#parentReference", # This is always drive#parentReference.
    "id": "A String", # The ID of the parent.
    "isRoot": True or False, # Whether or not the parent is the root folder.
    "parentLink": "A String", # A link to the parent.
  }
list(fileId)
Lists a file's parents.

Args:
  fileId: string, The ID of the file. (required)

Returns:
  An object of the form:

    { # A list of a file's parents.
    "items": [ # The list of parents.
      { # A reference to a file's parent.
        "selfLink": "A String", # A link back to this reference.
        "kind": "drive#parentReference", # This is always drive#parentReference.
        "id": "A String", # The ID of the parent.
        "isRoot": True or False, # Whether or not the parent is the root folder.
        "parentLink": "A String", # A link to the parent.
      },
    ],
    "kind": "drive#parentList", # This is always drive#parentList.
    "etag": "A String", # The ETag of the list.
    "selfLink": "A String", # A link back to this list.
  }