# RoomsByFileId
Get the token of the room associated to the given file id
This is the counterpart of self::getRoomByShareToken() for file ids instead of share tokens, although both return the same room token if the given file id and share token refer to the same file.
If there is no room associated to the given file id a new room is created; the new room is a public room associated with a "file" object with the given file id. Unlike normal rooms in which the owner is the user that created the room these are special rooms without owner (although self joined users with direct access to the file become persistent participants automatically when they join until they explicitly leave or no longer have access to the file).
In any case, to create or even get the token of the room, the file must be shared and the user must be the owner of a public share of the file (like a link share, for example) or have direct access to that file; an error is returned otherwise. A user has direct access to a file if they have access to it (or to an ancestor) through a user, group, circle or room share (but not through a link share, for example), or if they are the owner of such a file.
## Documentation
This is the counterpart of self::getRoomByShareToken() for file ids instead of share tokens, although both return the same room token if the given file id and share token refer to the same file.
If there is no room associated to the given file id a new room is created; the new room is a public room associated with a "file" object with the given file id. Unlike normal rooms in which the owner is the user that created the room these are special rooms without owner (although self joined users with direct access to the file become persistent participants automatically when they join until they explicitly leave or no longer have access to the file).
In any case, to create or even get the token of the room, the file must be shared and the user must be the owner of a public share of the file (like a link share, for example) or have direct access to that file; an error is returned otherwise. A user has direct access to a file if they have access to it (or to an ancestor) through a user, group, circle or room share (but not through a link share, for example), or if they are the owner of such a file.
- Catalog: `Spreed`
- Schema: `Spreed`
This is a read-only table function. The Nextcloud API may not support changing the data or the Invantive UniversalSQL driver for Nextcloud does not cover it. In the latter case, please use the table NativePlatformScalarRequests to upload data to the Nextcloud API.
## Parameters of Table Function
The following parameters can be used to control the behaviour of the table function `RoomsByFileId`. A value must be provided at all times for required parameters, but optional parameters in general do not need to have a value and the execution will default to a pre-defined behaviour. Values can be specified by position and by name. In both cases, all parameters not specified will be evaluated using their default values.
Value specification by position is done by listing all values from the first to the last needed value. For example: a `select * from table(value1, value2, value3)` on a table with four parameters will use the default value for the fourth parameter and the specified values for the first three.
Value specification by name is done by listing all values that require a value. For example with `select * from table(name1 => value1, name3 => value3)` on the same table will use the default values for the second and fourth parameters and the specified values for the first and third.
| Name | Data Type | Required | Default Value | Documentation |
|---|:---:|:---:|:---:|---|
| `apiVersion` | `` | ☐ | v1 | Values: v1. |
| `fileId` | `` | ☑ | | ID of the file |
## Columns of Table Function
The columns of the table function `RoomsByFileId` are shown below. Each column has an SQL data type.
| Name | Data Type | Label | Required | Documentation |
|---|:---:|---|:---:|---|
| `ocs_data_token` | `varchar2` | | ☐ | |
| `ocs_meta_itemsperpage` | `varchar2` | | ☐ | |
| `ocs_meta_message` | `varchar2` | | ☐ | |
| `ocs_meta_status` | `varchar2` | | ☐ | |
| `ocs_meta_statuscode` | `int64` | | ☐ | |
| `ocs_meta_totalitems` | `varchar2` | | ☐ | |