Beginning Sept. 30, 2020, you will no longer be able to place a file in multiple parent folders; every file must have exactly one parent folder location. Following is a summary of behavior changes related to the Drive API's new single-parent model.
Requests that temporarily orphan a file or attempt to place a file in multiple parent folders now fail. For example, in v2 of the API, you cannot move files by using the combinations of
You can only add a parent folder to a file that doesn't have one. Use
files.list()to see if a parent can be added and if the user user has the access to add the file. This change affects:
You can only create files in one parent folder. To duplicate a file within other parent folders, use shortcuts. This change affects:
You can only move a file if the current user has share access to the file. Use
files.list()to see if the user can move a file. If a user doesn't have share access to a file, you can create a shortcut to the file. This change affects
When you use
files.update()to add a new parent folder to a file:
If the file already has one or more parents (due to the old multi-parenting model), and you are the file's owner, the file is added to the new single parent folder and removed from any current parent folders.
If the file already has one or more parents (due to the old multi-parenting model), and you aren't the file's owner, the call fails.
When you use
files.updateto move a file from one parent folder to another, and the file already has one or more parents (due to the old multi-parenting model):
- the file is moved to the new parent folder location.
- the existing parent folder(s), identified in the
removeParentfield, are removed.
- any existing parent folder(s), not identified in the
removeParentfield, are preserved.
If an operation results in a file without a parent, the file is placed under its owner’s My Drive. This change affects:
When transferring ownership of a file, the requester can control whether the transferred file is moved to the new owner’s My Drive or kept in its current location. If the requester chooses to move the file, any access inherited from the previous parent is lost. However, the access that had been directly added to the file is preserved. The previous owner maintains editor access on the file, just as they had prior to these changes. This change affects:
enforceSingleParentfield allows you to develop and test apps with the new single parent model. Using this field also ensures you don't have to make further changes to your app when single parenting becomes the enforced behavior. Set
trueon any requests to modify a file (create, move, add a parent folder) you make to the Drive API.