Working with Tasks on Exchange Server
Working with Tasks
Aspose.Email supports processing tasks on Exchange using the ExchangeTask class. Different properties exposed by ExchangeTask, like Subject, Status, DueDate, and Priority, can be used to configure the task on Exchange. The EWSClient class exposes functions like CreateTask, UpdateTask, and DeleteTask which are used to process tasks on Exchange. This article shows how to:
- Create a new task.
- Set a task’s timezone.
- Update a task.
- Delete a task.
- Send Task Request
- Save Task to Disc
Create New Task
The following code snippet shows you how to create a new task.
Specifying Timezone
The IEWSClient interface and ExchangeTask provide the TimeZoneId property for setting timezone information when creating a task. The following code snippet shows you how to specify Timezone.
Update Task
The following code snippets show how to update a task on an Exchange server.
Delete Task
The following code snippet shows you how to delete a task on an Exchange server.
Sending Task Request
Aspose.Email Exchange service provides the capability to send task requests similar to Outlook. The following code snippet shows you how to load a task request message from the disc and send it using the IEWSClient.
Saving Task to Disc
Aspose.Email also allows saving Exchange Tasks to disc in Outlook MSG format. The following code snippet shows you how to save a task to disc.
Listing Tasks from Exchange Server
IEWSClient provides the ListTasks method that can be used to fetch tasks from an Exchange Web Service. It has several overloads that can be used to retrieve the list of tasks from a specific folder or using some search criteria. The below code sample illustrates getting all or specific tasks from the Tasks folder.
Filtering Tasks from Exchange Server
Aspose.Email provides the capability to retrieve specific tasks from the server instead of retrieving all tasks from the server. The API can be used to retrieve tasks by task status such as Completed, Deferred, In Progress, Not started or Waiting on others. The ExchangeQueryBuilder class can be used to specify the desired criterion utilizing the Status property. It also allows specifying multiple conditions for retrieving desired tasks from Exchange Server. This is demonstrated by the following code sample.