Assign Access Permissions to Folder disk.folder.sharetouser
Scope:
diskWho can execute the method: a user with "Share" permission for the specified folder
The method disk.folder.sharetouser assigns access permissions to a folder.
Method Parameters
Required parameters are marked with *
|
Name |
Description |
|
id* |
Identifier of the folder. The identifier can be obtained using the method disk.storage.getchildren if the folder is located at the root of the storage, and using the method disk.folder.getchildren if the folder is located within another folder |
|
userId* |
Identifier of the user to whom access is granted. The identifier can be obtained using the method user.get |
|
taskName* |
Level of access granted to the user. Possible values:
|
The current user cannot grant permissions higher than their own level. For example, if the current user only has "Read" permission for the specified folder, they will not be able to grant another user "Edit" or "Full access" permissions.
Code Examples
How to Use Examples in Documentation
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"id":8994,"userId":1271,"taskName":"disk_access_read"}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/disk.folder.sharetouser
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"id":8994,"userId":1271,"taskName":"disk_access_read","auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/disk.folder.sharetouser
try
{
const response = await $b24.callMethod(
'disk.folder.sharetouser',
{
id: 8994,
userId: 1271,
taskName: 'disk_access_read',
}
);
const result = response.getData().result;
console.log('Folder shared to user with ID:', result);
processResult(result);
}
catch( error )
{
console.error('Error:', error);
}
try {
$response = $b24Service
->core
->call(
'disk.folder.sharetouser',
[
'id' => 8994,
'userId' => 1271,
'taskName' => 'disk_access_read'
]
);
$result = $response
->getResponseData()
->getResult();
echo 'Success: ' . print_r($result, true);
processData($result);
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error sharing folder to user: ' . $e->getMessage();
}
BX24.callMethod(
"disk.folder.sharetouser",
{
id: 8994,
userId: 1271,
taskName: 'disk_access_read'
},
function (result)
{
if (result.error())
console.error(result.error());
else
console.dir(result.data());
}
);
require_once('crest.php');
$result = CRest::call(
'disk.folder.sharetouser',
[
'id' => 8994,
'userId' => 1271,
'taskName' => 'disk_access_read'
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
Response Handling
HTTP Status: 200
{
"result": true,
"time": {
"start": 1768921227,
"finish": 1768921228.02202,
"duration": 1.0220201015472412,
"processing": 1,
"date_start": "2026-01-20T17:00:27+02:00",
"date_finish": "2026-01-20T17:00:28+02:00",
"operating_reset_at": 1768921827,
"operating": 0
}
}
Returned Data
|
Name |
Description |
|
result |
Returns |
|
time |
Information about the execution time of the request |
Error Handling
HTTP Status: 400
{
"error":"ERROR_ARGUMENT",
"error_description":"Invalid value of parameter {Parameter #1}"
}
|
Name |
Description |
|
error |
String error code. It may consist of digits, Latin letters, and underscores |
|
error_description |
Textual description of the error. The description is not intended to be shown to the end user in its raw form |
Possible Error Codes
|
Code |
Description |
Value |
|
|
Invalid value of parameter |
Required parameter not specified |
|
|
Could not find entity with id |
Folder with the specified |
|
|
Access denied |
Attempt to set permission level higher than the current user's |
|
|
Access denied |
Incorrect value provided for parameter |
Statuses and System Error Codes
HTTP Status: 20x, 40x, 50x
The errors described below may occur when calling any method.
|
Status |
Code |
Description |
|
|
|
An internal server error has occurred, please contact the server administrator or Bitrix24 technical support |
|
|
|
An internal server error has occurred, please contact the server administrator or Bitrix24 technical support |
|
|
|
The request intensity limit has been exceeded |
|
|
|
The current method is not allowed to be called using batch |
|
|
|
The maximum length of parameters passed to the batch method has been exceeded |
|
|
|
Invalid access token or webhook code |
|
|
|
The methods must be called using the HTTPS protocol |
|
|
|
The REST API is blocked due to overload. This is a manual individual block, to remove it you need to contact Bitrix24 technical support |
|
|
|
The REST API is available only on commercial plans |
|
|
|
The user whose access token or webhook was used to call the method lacks permissions |
|
|
|
The manifest is not available |
|
|
|
The request requires higher privileges than those provided by the webhook token |
|
|
|
The provided access token has expired |
|
|
|
The user does not have access to the application. This means that the application is installed, but the account administrator has allowed access to this application only for specific users |
|
|
|
The public part of the site is closed. To open the public part of the site on an on-premise installation, disable the option "Temporary closure of the public part of the site". Path to the setting: Desktop > Settings > Product Settings > Module Settings > Main Module > Temporary closure of the public part of the site |
Continue Learning
- Create a Subfolder disk.folder.addsubfolder
- Copy a folder and all its contents to the specified folder disk.folder.copyto
- Permanently Delete a Folder and All Its Contents disk.folder.deletetree
- Get a list of files and folders in the folder disk.folder.getchildren
- Get Public Link for Folder disk.folder.getexternallink
- Get Folder Field Descriptions disk.folder.getfields
- Get Folder Parameters disk.folder.get
- Move a folder and all its contents to the specified folder disk.folder.moveto
- Rename Folder disk.folder.rename
- Restore Folder from Trash disk.folder.restore
- Upload a New File to the Specified Folder disk.folder.uploadfile