Documentation

AddFiles

void
CTasks::AddFiles(
 ID,
 array arFiles,
 array arParams = array()
);

This method adds files to a task.

Method parameters

Parameter Description Available from version
ID ID of the task to which the files are added
arFiles  Array of file IDs
arParams Array of additional parameters:
  • USER_ID - ID of the user, on behalf of whom the file will be uploaded;
  • CHECK_RIGHTS_ON_FILES - check of access rights for the file (Y/N).
Optional.

Returned value

This method does not have returned value. 

Examples

<?
if (CModule::IncludeModule("tasks"))
{

$ID = 1;
$arFiles = array(102, 34, 5);

CTasks::AddFiles($ID, $arFiles);
}
?>

Attach file from drive to a task:

use Bitrix\Main\Loader;
use Bitrix\Tasks\Control\Task;

if (!Loader::includeModule('tasks'))
{
    return;
}

$userId = 1;
$taskId = 1367;
$diskFileId = 150;

$handler = new Task($userId);

try
{
    $task = $handler->update($taskId, [
        'UF_TASK_WEBDAV_FILES' => [
            'n' . $diskFileId,
        ],
    ]);
}
catch (Exception $exception)
{
}


© «Bitrix24», 2001-2024