To query Collaboration task lists, tasks and subtasks from a remote application, use the ITaskListManager interface in the IDK.
Maximum Results | Sets the maximum number of results returned. The default is to return all results. |
Order-By Fields and Sort Order | Sets the fields to be displayed with an order-by functionality, and sets the sort order (ascending or descending). The following fields support the order-by option: name, start date, end date, status, assigned to (tasks and subtasks only) and order (location of the task or subtask in the hierarchy - tasks and subtasks only). |
Security | Enables or disables the security filter that applies security to the result set with respect to the user that submitted the query. If the filter is enabled, the query result will only include objects for which the querying user has appropriate permission. The default is false (disabled); all objects matching the query criteria will be returned. |
Result Filter: Status | Limits queries by status (completed, pending or overdue). |
Result Filter: User | Tasks and subtasks only. Limits queries to those tasks assigned to a specific user. |
Result Filter: Assignment | Tasks and subtasks only. Limits queries to unassigned tasks. |
To query for task lists, tasks and subtasks, follow the steps below.
Java
... ITaskListFilter taskListFilter = tasklistManager.createTaskListFilter(); //set the query to search for all task lists //options can be set to search for task lists that contain only pending tasks, //completed tasks, or overdue tasks taskListFilter.setCompletionType(TaskListCompletionFilterType.ALL); //limit the return results to be 10 taskListFilter.setMaximumResults(10); //disable security checking against the user who performs the query, //so that all objects will be returned taskListFilter.setRestoreSecurity(false); //use TaskListQueryOrder to sort the query result by NAME in ascending order TaskListQueryOrder taskListQueryOrder = new TaskListQueryOrder(TaskListAttribute.NAME, true); taskListFilter.setQueryOrders(new TaskListQueryOrder(taskListQueryOrder)); //an array of ITaskList objects are returned from queryTaskLists(); // if no result is retrieved, a zero-length array will be returned ITaskList[] retrievedTaskLists = tasklistManager.queryTaskLists(project, taskListFilter); ...
.NET (C#)
... ITaskListFilter taskListFilter = tasklistManager.CreateTaskListFilter(); //set the query to search for all task list //options can be set to search for task lists that contain only pending tasks, //completed tasks, or overdue tasks. taskListFilter.CompletionType = TaskListCompletionFilterTypes.All; //limit the return results to be 10 taskListFilter.MaximumResults = 10; //disable security checking against the user who performs the query, //so that all objects will be returned taskListFilter.RestoreSecurity = false; //use TaskListQueryOrder to sort the query result by NAME in ascending order TaskListQueryOrder taskListQueryOrder = new TaskListQueryOrder(TaskListAttributes.Name, true); taskListFilter.QueryOrders = new TaskListQueryOrder(taskListQueryOrder); //an array of ITaskList objects are returned from queryTaskLists(); //if no result is retrieved, a zero-length array will be returned ITaskList[] retrievedTaskLists = tasklistManager.QueryTaskLists(project, taskListFilter); ...
.NET (VB)
... dim taskListFilter As ITaskListFilter = tasklistManager.CreateTaskListFilter(); 'set the query to search for all task list 'options can be set to search for task lists that contain only pending tasks, 'completed tasks, or overdue tasks. taskListFilter.CompletionType = TaskListCompletionFilterTypes.All 'limit the return results to be 10 taskListFilter.MaximumResults = 10 'disable security checking against the user who performs the query, 'so that all objects will be returned taskListFilter.RestoreSecurity = false 'use TaskListQueryOrder to sort the query result by NAME in ascending order dim taskListQueryOrder As TaskListQueryOrder = new TaskListQueryOrder(TaskListAttributes.Name, true) taskListFilter.QueryOrders(0) = taskListQueryOrder 'an array of ITaskList objects are returned from queryTaskLists() 'if no result is retrieved, a zero-length array will be returned dim retrievedTaskLists() As ITaskList = tasklistManager.QueryTaskLists(project, taskListFilter) ...