Skip to content

Latest commit

 

History

History
131 lines (93 loc) · 3.76 KB

tasks.md

File metadata and controls

131 lines (93 loc) · 3.76 KB

Tasks

Task objects represent a user-created task on a file.

Get a Task's Information

Calling getInfo() on a task returns a snapshot of the task's info.

BoxTask task = new BoxTask(api, "id");
BoxTask.Info info = task.getInfo();

Get the Tasks on a File

You can get all of the tasks on a file by calling the getTasks() method.

BoxFile file = new BoxFile(api, "id");
List<BoxTask.Info> tasks = file.getTasks();

Add a Task to a File

A task can be added to a file with the addTask(String, String, Date) method.

BoxFile file = new BoxFile(api, "id");
Date dueAt = new Date();
file.addTask("review", "Please review this file.", dueAt);

Update a Task's Information

The message of a task can be changed with the updateInfo(BoxTask.Info) method.

BoxTask task = new BoxTask(api, "id");
BoxTask.Info info = task.new Info();
info.setMessage("An edited message.");
task.updateInfo(info);

Delete a Task

A task can be deleted with the delete() method.

BoxTask task = new BoxTask(api, "id");
task.delete();

Get a Task's Assignments

Retreive a tasks assignments with the getAssignments() method.

BoxTask task = new BoxTask(api, "id");
task.getAssignments();

Add a Task Assignment

An assignment can be added to a task with the addAssignment(BoxUser) method.

BoxUser user = new BoxUser(api, "user-id")
BoxTask task = new BoxTask(api, "id");
task.addAssignment(user);

Delete a Task Assignment

An assignment can be deleted from a task with the delete() method on a BoxTaskAssignment instance.

BoxTaskAssignment taskAssignment = new BoxTaskAssignment(api, "id");
taskAssignment.delete();

Update a Task Assignment

A task assignment can be updated with the updateInfo(BoxTask.Info) method.

BoxTaskAssignment taskAssignment = new BoxTaskAssignment(api, id);
BoxTaskAssignment.Info info = taskAssignment.getInfo();
taskAssignment.updateInfo(info);