> Markdown versions of all pages of this connector library are available by appending `.md` to the page URL. For the full index of connectors, see [llms.txt](https://connectors.appmixer.com/llms.txt).

# appmixer.google.drive.AddFileOrFolderPermission

- Component: `appmixer.google.drive.AddFileOrFolderPermission`
- Kind: Action
- Version: 2.0.0
- Visibility: Public
- Connector: [appmixer.google.drive 2.5.0](https://connectors.appmixer.com/connector/appmixer.google.drive/2.5.0.md)
- Component page: <https://connectors.appmixer.com/connector/appmixer.google.drive/2.5.0/component/appmixer.google.drive.AddFileOrFolderPermission>

Add a permission to a file or folder in Google Drive.

## Input ports

### Port `in`

| Field | Type | Description |
| --- | --- | --- |
| Google Drive File or Folder ID (`googleDriveFileId`) | googlepicker | The ID of the Google Drive file or folder you wish to add a sharing permission for. You can use the Google Picker utility to select the file or folder or the variables picker to enter a variable referencing a Google Drive File or Folder ID. |
| Permission Type (`type`) | select | The type of permission to add. The value can be 'user', 'group', 'domain', or 'anyone'. |
| Permission Role (`role`) | select | The role of the permission. The value can be 'organizer', 'fileOrganizer', 'writer', 'commenter', or 'reader'. |
| Email Address (`emailAddress`) | text | An email address of the user or group to whom you want to grant the permission. |
| Domain (`domain`) | text | The domain to which you want to grant the permission. |

## Output ports

### Port `out`

| Field | Type | Description |
| --- | --- | --- |
| GDrive File or Folder ID (`fileId`) | string | - |
| GDrive Permission (`permission`) | object | - |

## Full metadata (component.json)

```json
{
  "name": "appmixer.google.drive.AddFileOrFolderPermission",
  "author": "Appmixer <info@appmixer.com>",
  "description": "Add a permission to a file or folder in Google Drive.",
  "private": false,
  "version": "2.0.0",
  "auth": {
    "service": "appmixer:google:drive",
    "scope": [
      "https://www.googleapis.com/auth/drive",
      "https://www.googleapis.com/auth/drive.readonly"
    ]
  },
  "quota": {
    "manager": "appmixer:google:drive",
    "resources": "readandwrite",
    "scope": {
      "userId": "{{userId}}"
    }
  },
  "inPorts": [
    {
      "name": "in",
      "schema": {
        "type": "object",
        "properties": {
          "googleDriveFileId": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "object"
              }
            ]
          },
          "type": {
            "enum": [
              "user",
              "group",
              "domain",
              "anyone"
            ]
          },
          "role": {
            "enum": [
              "organizer",
              "fileOrganizer",
              "writer",
              "commenter",
              "reader"
            ]
          },
          "emailAddress": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          }
        },
        "required": [
          "googleDriveFileId"
        ]
      },
      "inspector": {
        "inputs": {
          "googleDriveFileId": {
            "type": "googlepicker",
            "view": [
              "DOCS",
              "FOLDERS"
            ],
            "index": 1,
            "label": "Google Drive File or Folder ID",
            "placeholder": "Choose a Google Drive file or folder...",
            "tooltip": "The ID of the Google Drive file or folder you wish to add a sharing permission for. You can use the Google Picker utility to select the file or folder or the variables picker to enter a variable referencing a Google Drive File or Folder ID."
          },
          "type": {
            "type": "select",
            "index": 2,
            "label": "Permission Type",
            "options": [
              {
                "label": "User",
                "value": "user"
              },
              {
                "label": "Group",
                "value": "group"
              },
              {
                "label": "Domain",
                "value": "domain"
              },
              {
                "label": "Anyone",
                "value": "anyone"
              }
            ],
            "tooltip": "The type of permission to add. The value can be 'user', 'group', 'domain', or 'anyone'."
          },
          "role": {
            "type": "select",
            "index": 3,
            "label": "Permission Role",
            "options": [
              {
                "label": "Writer",
                "value": "writer"
              },
              {
                "label": "Commenter",
                "value": "commenter"
              },
              {
                "label": "Reader",
                "value": "reader"
              },
              {
                "label": "Organizer",
                "value": "organizer"
              },
              {
                "label": "File Organizer",
                "value": "fileOrganizer"
              }
            ],
            "tooltip": "The role of the permission. The value can be 'organizer', 'fileOrganizer', 'writer', 'commenter', or 'reader'."
          },
          "emailAddress": {
            "type": "text",
            "index": 4,
            "label": "Email Address",
            "tooltip": "An email address of the user or group to whom you want to grant the permission.",
            "when": {
              "or": [
                {
                  "eq": {
                    "type": "user"
                  }
                },
                {
                  "eq": {
                    "type": "group"
                  }
                }
              ]
            }
          },
          "domain": {
            "type": "text",
            "index": 4,
            "label": "Domain",
            "tooltip": "The domain to which you want to grant the permission.",
            "when": {
              "or": [
                {
                  "eq": {
                    "type": "domain"
                  }
                }
              ]
            }
          }
        }
      }
    }
  ],
  "outPorts": [
    {
      "name": "out",
      "options": [
        {
          "label": "GDrive File or Folder ID",
          "value": "fileId",
          "schema": {
            "type": "string",
            "example": "1pg87Zh20jkToMgYsM2p1kQhUb2YbKPbn"
          }
        },
        {
          "label": "GDrive Permission",
          "value": "permission",
          "schema": {
            "example": {
              "kind": "drive#permission",
              "id": "04935312851898644844",
              "type": "user",
              "emailAddress": "jane.doe@example.com",
              "role": "owner",
              "displayName": "Jane Doe",
              "photoLink": "https://lh3.googleusercontent.com/a/default-user=s64",
              "deleted": false,
              "pendingOwner": false,
              "allowFileDiscovery": false,
              "domain": "example.com",
              "expirationTime": "2027-01-01T00:00:00.000Z",
              "view": "published",
              "permissionDetails": [
                {
                  "permissionType": "file",
                  "role": "owner",
                  "inherited": false,
                  "inheritedFrom": "1mVtsZHdqtWTzvGjOWRDdG2O14un9GK8y"
                }
              ],
              "teamDrivePermissionDetails": []
            },
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "displayName": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "kind": {
                "type": "string"
              },
              "permissionDetails": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "permissionType": {
                      "type": "string"
                    },
                    "inheritedFrom": {
                      "type": "string"
                    },
                    "role": {
                      "type": "string"
                    },
                    "inherited": {
                      "type": "boolean"
                    }
                  }
                }
              },
              "photoLink": {
                "type": "string"
              },
              "emailAddress": {
                "type": "string"
              },
              "role": {
                "type": "string"
              },
              "allowFileDiscovery": {
                "type": "boolean"
              },
              "domain": {
                "type": "string"
              },
              "expirationTime": {
                "type": "string"
              },
              "deleted": {
                "type": "boolean"
              },
              "view": {
                "type": "string"
              },
              "pendingOwner": {
                "type": "boolean"
              }
            }
          }
        }
      ]
    }
  ],
  "icon": "(data URI omitted)"
}
```
