Task objects represent a user-created task on a file.
- Get a Task's Information
- Get the Tasks on a File
- Add a Task to a File
- Update a Task's Information
- Delete a Task
- Get a Task's Assignments
- Add a Task Assignment
- Update a Task Assignment
- Delete a Task Assignment
Calling getInfo()
on a task returns a snapshot of the task's
info.
BoxTask task = new BoxTask(api, "id");
BoxTask.Info info = task.getInfo();
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();
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);
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);
A task can be deleted with the delete()
method.
BoxTask task = new BoxTask(api, "id");
task.delete();
Retreive a tasks assignments with the getAssignments()
method.
BoxTask task = new BoxTask(api, "id");
task.getAssignments();
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);
An assignment can be deleted from a task with the delete()
method on a BoxTaskAssignment
instance.
BoxTaskAssignment taskAssignment = new BoxTaskAssignment(api, "id");
taskAssignment.delete();
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);