# 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, Set to true to opt in to API behavior that aims for all items to have exactly one parent. This parameter only takes effect if the item is not in a shared drive. If the item's last parent is removed, the item is 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, Set to true to opt in to API behavior that aims for all items to have exactly one parent. This parameter only takes effect if the item is not in a shared drive. If the child's owner makes the request, the child is removed from all current folders and placed in the requested folder. Any other requests that increase the number of the child's parents fail, except when the canAddMyDriveParent file capability is true and a single parent is being added.
      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.
      }