Method: permissions.insert
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Inserta un permiso para un archivo o una unidad compartida.
Advertencia: No se admiten operaciones de permisos simultáneas en el mismo archivo. Solo se aplica la última actualización.
Solicitud HTTP
POST https://www.googleapis.com/drive/v2/files/{fileId}/permissions
La URL usa la sintaxis de la transcodificación gRPC.
Parámetros de ruta de acceso
Parámetros |
fileId |
string
El ID del archivo o la unidad compartida.
|
Parámetros de consulta
Parámetros |
emailMessage |
string
Es un mensaje personalizado de texto sin formato para incluir en los correos electrónicos de notificación.
|
enforceSingleParent (deprecated) |
boolean
Obsoleto: Consulta moveToNewOwnersRoot para obtener más información.
|
moveToNewOwnersRoot |
boolean
Este parámetro solo se aplicará si el elemento no está en una unidad compartida y la solicitud intenta transferir la propiedad del elemento. Si se establece en true , el elemento se moverá a la carpeta raíz de Mi unidad del nuevo propietario y se quitarán todas las carpetas superiores anteriores. Si se establece en false , no se cambian los elementos superiores.
|
sendNotificationEmails |
boolean
Si quieres enviar correos electrónicos de notificación cuando compartas contenido con usuarios o grupos. Este parámetro se ignora y se envía un correo electrónico si role es owner .
|
supportsAllDrives |
boolean
Si la aplicación solicitante admite Mi unidad y unidades compartidas
|
supportsTeamDrives (deprecated) |
boolean
Obsoleto: Usa supportsAllDrives en su lugar.
|
useDomainAdminAccess |
boolean
Emite la solicitud como administrador de dominio. Si se establece como verdadero, se le otorgará acceso al solicitante si el parámetro de ID de archivo hace referencia a una unidad compartida y el solicitante es administrador del dominio al que pertenece la unidad compartida.
|
enforceExpansiveAccess |
boolean
Indica si la solicitud debe aplicar reglas de acceso expansivas.
|
Cuerpo de la solicitud
El cuerpo de la solicitud contiene una instancia de Permission
.
Cuerpo de la respuesta
Si el proceso se realiza de forma correcta, el cuerpo de la respuesta contiene una instancia recién creada de Permission
.
Permisos de autorización
Se necesita uno de los siguientes permisos de OAuth:
https://www.googleapis.com/auth/docs
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.file
Algunos permisos están restringidos y requieren una evaluación de seguridad para que tu app los use. Para obtener más información, consulta la Guía de autorización.
Salvo que se indique lo contrario, el contenido de esta página está sujeto a la licencia Atribución 4.0 de Creative Commons, y los ejemplos de código están sujetos a la licencia Apache 2.0. Para obtener más información, consulta las políticas del sitio de Google Developers. Java es una marca registrada de Oracle o sus afiliados.
Última actualización: 2025-07-25 (UTC)
[null,null,["Última actualización: 2025-07-25 (UTC)"],[],[],null,["# Method: permissions.insert\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nInserts a permission for a file or shared drive.\n\n**Warning:** Concurrent permissions operations on the same file are not supported; only the last update is applied.\n\n### HTTP request\n\n`POST https://www.googleapis.com/drive/v2/files/{fileId}/permissions`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|----------|-----------------------------------------------|\n| `fileId` | `string` The ID for the file or shared drive. |\n\n### Query parameters\n\n| Parameters ||\n|----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `emailMessage` | `string` A plain text custom message to include in notification emails. |\n| `enforceSingleParent` **(deprecated)** | `boolean` Deprecated: See `moveToNewOwnersRoot` for details. |\n| `moveToNewOwnersRoot` | `boolean` This parameter will only take effect if the item is not in a shared drive and the request is attempting to transfer the ownership of the item. If set to `true`, the item will be moved to the new owner's My Drive root folder and all prior parents removed. If set to `false`, parents are not changed. |\n| `sendNotificationEmails` | `boolean` Whether to send notification emails when sharing to users or groups. This parameter is ignored and an email is sent if the `role` is `owner`. |\n| `supportsAllDrives` | `boolean` Whether the requesting application supports both My Drives and shared drives. |\n| `supportsTeamDrives` **(deprecated)** | `boolean` Deprecated: Use `supportsAllDrives` instead. |\n| `useDomainAdminAccess` | `boolean` Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs. |\n| `enforceExpansiveAccess` | `boolean` Whether the request should enforce expansive access rules. |\n\n### Request body\n\nThe request body contains an instance of [Permission](/workspace/drive/api/reference/rest/v2/permissions#Permission).\n\n### Response body\n\nIf successful, the response body contains a newly created instance of [Permission](/workspace/drive/api/reference/rest/v2/permissions#Permission).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/docs`\n- `\n https://www.googleapis.com/auth/drive`\n- `\n https://www.googleapis.com/auth/drive.file`\n\nSome scopes are restricted and require a security assessment for your app to use them. For more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent)."]]