# Drive API . parents

## Instance Methods

Close httplib2 connections.

Removes a parent from a file.

Gets a specific parent reference.

Adds a parent folder for a file.

Lists a file's parents.

### Method Details

`close()`

    Close httplib2 connections.

`delete(fileId, parentId, enforceSingleParent=None)`

    Removes a parent from a file.

    Args:
      fileId: string, The ID of the file. (required)
      parentId: string, The ID of the parent. (required)
      enforceSingleParent: boolean, Deprecated. If an item is not in a shared drive and its last parent is deleted but the item itself is not, the item will be placed under its owner's root.

`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.
      "id": "A String", # The ID of the parent.
      "isRoot": True or False, # Whether or not the parent is the root folder.
      "kind": "drive#parentReference", # This is always drive#parentReference.
      "parentLink": "A String", # A link to the parent.
      "selfLink": "A String", # A link back to this reference.
    }

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

    Adds a parent folder for a file.

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

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

      enforceSingleParent: boolean, Deprecated. Adding files to multiple folders is no longer supported. Use shortcuts instead.
      supportsAllDrives: boolean, Whether the requesting application supports both My Drives and shared drives.
      supportsTeamDrives: boolean, Deprecated use supportsAllDrives instead.

    Returns:
      An object of the form:

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

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