Partager via


TaskItem.Assign Method (Outlook)

Assigns a task and returns a TaskItem object that represents it.

Syntax

expression .Assign

expression A variable that represents a TaskItem object.

Return Value

A TaskItem object that represents the task.

Remarks

This method allows a task to be assigned (delegated) to another user. You must create a task before you can assign it, and you must assign a task before you can send it. An assigned task is sent as a TaskRequestItem object.

Example

This Visual Basic for Applications (VBA) example uses CreateItem to create a simple task and delegate it as a task request to another user. To run this example, replace 'Dan Wilson' with a valid recipient name.

Sub AssignTask() 
 
 Dim myItem As Outlook.TaskItem 
 
 Dim myDelegate As Outlook.Recipient 
 
 
 
 Set MyItem = Application.CreateItem(olTaskItem) 
 
 MyItem.Assign 
 
 Set myDelegate = MyItem.Recipients.Add("Dan Wilson") 
 
 myDelegate.Resolve 
 
 If myDelegate.Resolved Then 
 
 myItem.Subject = "Prepare Agenda For Meeting" 
 
 myItem.DueDate = Now + 30 
 
 myItem.Display 
 
 myItem.Send 
 
 End If 
 
End Sub

See Also

Concepts

TaskItem Object

TaskItem Object Members