TaskItem Properties

These properties are for Outlook 2003 but should also work in Outlook 2007. There are additional properties for Outlook 2007 which are not yet documented here, but I will add them eventually (and indicate which are for Outlook 2007 only). Each function includes sample VBA code.

Actions Property

Function GetTaskActions(tsk As Outlook.TaskItem) As Outlook.Actions
  Set GetTaskActions = tsk.Actions
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim acts As Outlook.Actions
  Set tsk = Outlook.CreateItem(olTaskItem)
  Set acts = GetTaskActions(tsk)
End Sub

Attachments Property

Function GetTaskAttachments(tsk As Outlook.TaskItem) _
    As Outlook.Attachments
  Set GetTaskAttachments = tsk.Attachments
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim attachs As Outlook.Attachments
  Set tsk = Outlook.CreateItem(olTaskItem)
  Set attachs = GetTaskAttachments(tsk)
End Sub

ActualWork Property

Function GetTaskActualWork(tsk As Outlook.TaskItem) As Long
  GetTaskActualWork = tsk.ActualWork
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim taskWork As Long
  Set tsk = Outlook.CreateItem(olTaskItem)
  taskWork = GetTaskActualWork(tsk)
End Sub

AutoResolvedWinner Property

Function IsTaskAutoResolvedWinner(tsk As Outlook.TaskItem) As Boolean
' From Outlook Help:
'If an item has its Conflicts.Count property greater than zero and if
' its AutoResolvedWinner property is True, it is a winner of an automatic
' conflict resolution. On the other hand, if the item is in conflict and has
' its AutoResolvedWinner property as False, it is a loser in an automatic
' conflict resolution.

IsTaskAutoResolvedWinner = ((tsk.Conflicts.Count > 0) And (tsk.AutoResolvedWinner = True))

End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim isWinner As Boolean
  Set tsk = Outlook.CreateItem(olTaskItem)
  isWinner = IsTaskAutoResolvedWinner(tsk)
End Sub

BillingInformation Property

Function TaskBillingInformation(tsk As Outlook.TaskItem, _
    Optional billingInfo As String, _
    Optional append As Boolean = False) As String
' set or get task billing information

  If Len(billingInfo) > 0 Then

    If append Then
      ' append value to existing
      tsk.BillingInformation = tsk.BillingInformation & billingInfo
    Else
      ' set value
      tsk.BillingInformation = billingInfo
    End If
  End If

  ' return whether updated or replaced or just checking value
  TaskBillingInformation = tsk.BillingInformation

End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim billingInfo As String
  Set tsk = Outlook.CreateItem(olTaskItem)
  billingInfo = TaskBillingInformation(tsk)
End Sub

CardData Property

Function GetTaskCardData(tsk As Outlook.TaskItem) As String
  GetTaskCardData = tsk.CardData
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim cd As String
  Set tsk = Outlook.CreateItem(olTaskItem)
  cd = GetTaskCardData(tsk)
End Sub

Class Property

Function GetTaskClass(tsk As Outlook.TaskItem) As OlObjectClass
GetTaskClass = tsk.Class
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim cls As OlObjectClass
  Set tsk = Outlook.CreateItem(olTaskItem)
  cls = GetTaskClass(tsk)
End Sub

Companies Property

Function TaskCompanies(tsk As Outlook.TaskItem, _
    Optional companyInfo As String, _
    Optional append As Boolean = False) As String
' set or get task companies string

  If Len(companyInfo) > 0 Then

    If append Then
      ' append value to existing
      tsk.Companies = tsk.Companies & companyInfo
    Else
      ' set value
      tsk.Companies = companyInfo
    End If
  End If

  ' return whether updated or replaced or just checking value
  TaskCompanies = tsk.Companies

End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim companyInfo As String
  Set tsk = Outlook.CreateItem(olTaskItem)
  companyInfo = TaskCompanies(tsk)
End Sub

Conflicts Property

Function IsTaskInConflict(tsk As Outlook.TaskItem) As Boolean
  IsTaskInConflict = ((tsk.Conflicts.Count > 0) Or (tsk.IsConflict))
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim isInConflict As Boolean
  Set tsk = Outlook.CreateItem(olTaskItem)
  isInConflict = IsTaskInConflict(tsk)
End Sub
Function GetTaskConflicts(tsk As Outlook.TaskItem) As Outlook.Conflicts
  Set GetTaskConflicts = tsk.Conflicts
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim cfts = Outlook.Conflicts
  Set tsk = Outlook.CreateItem(olTaskItem)
  Set cfts = GetTaskConflicts(tsk)
End Sub

ContactNames Property

Function TaskContactNames(tsk As Outlook.TaskItem, _
    Optional names As String, _
    Optional append As Boolean = False) As String
' set or get task contact names

  If Len(names) > 0 Then
    If append Then
      ' append value to existing
      tsk.ContactNames = tsk.ContactNames & names
    Else
      ' set value
      tsk.ContactNames = names
    End If
  End If

  ' return whether updated or replaced or just checking value
  TaskContactNames = tsk.ContactNames

End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim names As String
  Set tsk = Outlook.CreateItem(olTaskItem)
  names = TaskContactNames(tsk)
End Sub

ConversationIndex Property

Function GetTaskCI(tsk As Outlook.TaskItem) As String
  GetTaskCI = tsk.ConversationIndex
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim cIndex As String
  Set tsk = Outlook.CreateItem(olTaskItem)
  cIndex = GetTaskCI(tsk)
End Sub

ConversationTopic Property

Function GetTaskCT(tsk As Outlook.TaskItem) As String
  GetTaskCT = tsk.ConversationTopic
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim convTopic As String
  Set tsk = Outlook.CreateItem(olTaskItem)
  convTopic = GetTaskCT(tsk)
End Sub

Body Property

Function TaskBody(tsk As Outlook.TaskItem, _
    Optional bodyText As String, _
    Optional append As Boolean = False) As String
' set or get task body text

  If Len(bodyText) > 0 Then
    ' set body text
    If append Then
      ' add to existing body text
      tsk.Body = tsk.Body & bodyText
    Else
      ' replace with new body text
      tsk.Body = bodyText
    End If
  End If

  ' return body, whether updated or replaced or just checking value
  TaskBody = tsk.body

End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim bodyText As String
  Set tsk = Outlook.CreateItem(olTaskItem)
  bodyText = TaskBody(tsk)
End Sub

Categories Property

Function GetTaskCategories(tsk As Outlook.TaskItem) As String
  GetTaskCategories = tsk.Categories
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim cats As String
  Set tsk = Outlook.CreateItem(olTaskItem)
  cats = GetTaskCategories(tsk)
End Sub

Complete Property

Function IsTaskComplete(tsk As Outlook.TaskItem) As Boolean
  IsTaskComplete = tsk.Complete
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim isComplete As Boolean
  Set tsk = Outlook.CreateItem(olTaskItem)
  isComplete = IsTaskComplete(tsk)
End Sub

CreationTime Property

Function GetTaskCreationTime(tsk As Outlook.TaskItem) As Date
  GetTaskCreationTime = tsk.CreationTime
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim createDate As Date
  Set tsk = Outlook.CreateItem(olTaskItem)
  createDate = GetTaskCreationTime(tsk)
End Sub

DelegationState Property

Function GetTaskDelegationState(tsk As Outlook.TaskItem) _
    As OlTaskDelegationState
  GetTaskDelegationState = tsk.DelegationState
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim delegateState As OlTaskDelegationState
  Set tsk = Outlook.CreateItem(olTaskItem)
  delegateState = GetTaskDelegationState(tsk)
End Sub

Delegator Property

Function GetTaskDelegator(tsk As Outlook.TaskItem) As String
  GetTaskDelegator = tsk.Delegator
End Function

Sub Test1()
Dim tsk As Outlook.TaskItem
Dim delegatorName As String
  Set tsk = Outlook.CreateItem(olTaskItem)
  delegatorName = GetTaskDelegator(tsk)
End Sub
Function IsTaskDelegated(tsk As Outlook.TaskItem) As Boolean
' check Delegator property, if not blank then task
' must be delegated!
  IsTaskDelegated = (Len(tsk.Delegator) > 0)
End Function

Sub Test2()
Dim tsk As Outlook.TaskItem
Dim delegated As Boolean
  Set tsk = Outlook.CreateItem(olTaskItem)
  delegated = IsTaskDelegated(tsk)
End Sub

DownloadState Property

Function GetTaskDownloadState(tsk As Outlook.TaskItem) As OlDownloadState
  GetTaskDownloadState = tsk.DownloadState
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim dlState As OlDownloadState
  Set tsk = Outlook.CreateItem(olTaskItem)
  dlState = GetTaskDownloadState(tsk)
End Sub

DueDate Property

Function TaskDueDate(tsk As Outlook.TaskItem, _
    Optional dateDue As Date) As Date
' get or set task due date
If dateDue <> #1/1/4501# Then  ' it was specified
' set value
    tsk.DueDate = dateDue
    TaskDueDate = dateDue
  Else
    ' return current value
    TaskDueDate = tsk.DueDate
  End If
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim taskDueDate As Date
  Set tsk = Outlook.CreateItem(olTaskItem)
  taskDueDate = TaskDueDate(tsk)
End Sub

EntryID Property

Function GetTaskEntryID(tsk As Outlook.TaskItem) As String
  GetTaskEntryID = tsk.EntryID
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim entry_ID As String
  Set tsk = Outlook.CreateItem(olTaskItem)
  entry_ID = GetTaskEntryID(tsk)
End Sub

FormDescription Property

Function GetTaskFormDescription(tsk As Outlook.TaskItem) _
    As Outlook.FormDescription
  Set GetTaskFormDescription = tsk.FormDescription
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim frmDesc As Outlook.FormDescription
  Set tsk = Outlook.CreateItem(olTaskItem)
  Set frmDesc = GetTaskFormDescription(tsk)
End Sub

GetInspector Property

Function GetTaskInspector(tsk As Outlook.TaskItem) As Outlook.Inspector
  Set GetTaskInspector = tsk.GetInspector
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim insp As Outlook.Inspector
  Set tsk = Outlook.CreateItem(olTaskItem)
  Set insp = GetTaskInspector(tsk)
End Sub

Importance Property

Function GetTaskImportance(tsk As Outlook.TaskItem) As OlImportance
  GetTaskImportance = tsk.Importance
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim imp As OlImportance
  Set tsk = Outlook.CreateItem(olTaskItem)
  imp = GetTaskImportance(tsk)
End Sub

InternetCodepage Property

Function GetTaskICP(tsk As Outlook.TaskItem) As Long
  GetTaskICP = tsk.InternetCodepage
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim ICP As Long
  Set tsk = Outlook.CreateItem(olTaskItem)
  ICP = GetTaskICP(tsk)
End Sub

IsRecurring Property

Function IsTaskRecurring(tsk As Outlook.TaskItem) As Boolean
  IsTaskRecurring = tsk.IsRecurring
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim recur As Boolean
  Set tsk = Outlook.CreateItem(olTaskItem)
  recur = IsTaskRecurring(tsk)
End Sub

ItemProperties Property

Function GetTaskItemProperties(tsk As Outlook.TaskItem) _
    As Outlook.ItemProperties
  Set GetTaskItemProperties = tsk.ItemProperties
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim tskProperties As Outlook.ItemProperties
  Set tsk = Outlook.CreateItem(olTaskItem)
  Set tskProperties = GetTaskItemProperties(tsk)
End Sub

LastModificationTime Property

Function GetTaskLastModTime(tsk As Outlook.TaskItem) As Date
  GetTaskLastModTime = tsk.LastModificationTime
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim taskLastModTime As Date
  Set tsk = Outlook.CreateItem(olTaskItem)
  taskLastModTime = GetTaskLastModTime(tsk)
End Sub

Links Property

Function GetTaskLinks(tsk As Outlook.TaskItem) As Outlook.Links
  Set GetTaskLinks = tsk.Links
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim tskLinks As Outlook.Links
  Set tsk = Outlook.CreateItem(olTaskItem)
  Set tskLinks = GetTaskLinks(tsk)
End Sub

MarkForDownload Property

Function TaskMarkForDownload(tsk As Outlook.TaskItem, _
    Optional remoteStatus As OlRemoteStatus) As OlRemoteStatus
' set or get remote status

  Select Case remoteStatus

      ' if remoteStatus is specified, set it for the current TaskItem
    Case olMarkedForCopy, olMarkedForDelete, olMarkedForDownload, _
         olRemoteStatusNone, olUnMarked
      tsk.MarkForDownload = remoteStatus
      TaskMarkForDownload = remoteStatus
    Case Else
      ' just return current status
      TaskMarkForDownload = tsk.MarkForDownload
  End Select

End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim taskMFD As OlRemoteStatus
  Set tsk = Outlook.CreateItem(olTaskItem)
  taskMFD = TaskMarkForDownload(tsk)
End Sub

MessageClass Property

Function TaskMessageClass(tsk As Outlook.TaskItem, _
    Optional msgClass As String) As String
' set or get task message class

' what are the possible values?

  If Len(msgClass) > 0 Then
    tsk.MessageClass = msgClass
    TaskMessageClass = msgClass
  Else
    ' return value
    TaskMessageClass = tsk.MessageClass
  End If
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim taskMsgClass As String
  Set tsk = Outlook.CreateItem(olTaskItem)
  taskMsgClass = TaskMessageClass(tsk)
End Sub

Mileage Property

Function TaskMileage(tsk As Outlook.TaskItem, _
    Optional mileageValue As String, _
    Optional append As Boolean = False) As String
' set or get task mileage

  If Len(mileageValue) > 0 Then
    If append Then
      tsk.Mileage = tsk.Mileage & mileageValue
    Else
      tsk.Mileage = mileageValue
    End If
  End If

  ' return value, either appended, unchanged or changed
  TaskMileage = tsk.Mileage

End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim miles As String
  Set tsk = Outlook.CreateItem(olTaskItem)
  miles = TaskMileage(tsk)
End Sub

NoAging Property

Function TaskNoAging(tsk As Outlook.TaskItem, _
    Optional ageItem As Variant) As Boolean
' set or get task aging

  If IsMissing(ageItem) Then
    ' return current value
    TaskNoAging = tsk.NoAging
  Else
    ' set value
    tsk.NoAging = ageItem
    TaskNoAging = ageItem
  End If

End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim isTaskAging As Boolean
  Set tsk = Outlook.CreateItem(olTaskItem)
  isTaskAging = Not TaskNoAging(tsk)
End Sub

DateCompleted Property

Function TaskDateCompleted(tsk As Outlook.TaskItem, _
    Optional dteCompleted As Date) As Date
' get or set task date completed
If dteCompleted <> #1/1/4501# Then  ' it was specified
' set value
    tsk.DateCompleted = dteCompleted
    TaskDateCompleted = dteCompleted
  Else
    ' return value
    TaskDateCompleted = tsk.DateCompleted
  End If
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim dte As Date
  Set tsk = Outlook.CreateItem(olTaskItem)
  dte = TaskDateCompleted(tsk)
End Sub

Ordinal Property

Function TaskOrdinal(tsk As Outlook.TaskItem, _
    Optional orderNum As Variant) As Long
' get or set ordinal value

  If Not IsMissing(orderNum) Then
    ' set value
    tsk.Ordinal = orderNum
  End If

  ' return value, whether changed or not
  TaskOrdinal = tsk.Ordinal

End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim ord As Long
  Set tsk = Outlook.CreateItem(olTaskItem)
  ord = TaskOrdinal(tsk)
End Sub

OutlookInternalVersion Property

Function TaskInternalVersion(tsk As Outlook.TaskItem) As Long
  TaskInternalVersion = tsk.OutlookInternalVersion
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim taskVersion As Long
  Set tsk = Outlook.CreateItem(olTaskItem)
  taskVersion = TaskInternalVersion(tsk)
End Sub

OutlookVersion Property

Function TaskOutlookVersion(tsk As Outlook.TaskItem) As String
  TaskOutlookVersion = tsk.OutlookVersion
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim taskVersion As String
  Set tsk = Outlook.CreateItem(olTaskItem)
  taskVersion = TaskOutlookVersion(tsk)
End Sub

Owner Property

Function TaskOwner(tsk As Outlook.TaskItem, _
    ownerName As String) As String
' get or set task owner name
  If Len(ownerName) > 0 Then
    tsk.Owner = ownerName
    TaskOwner = ownerName
  Else
    ' return current owner name
    TaskOwner = tsk.Owner
  End If
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim taskOwn As String
  Set tsk = Outlook.CreateItem(olTaskItem)
  taskOwnership = TaskOwner(tsk)
End Sub

Ownership Property

Function TaskOwnership(tsk As Outlook.TaskItem) As OlTaskOwnership
  TaskOwnership = tsk.Ownership
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim taskOwnership As OlTaskOwnership
  Set tsk = Outlook.CreateItem(olTaskItem)
  taskOwnership = TaskOwnership(tsk)
End Sub

Parent Property

Function GetTaskParent(tsk As Outlook.TaskItem) As Object
  Set GetTaskParent = tsk.Parent
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim parentObj As Object
  Set tsk = Outlook.CreateItem(olTaskItem)
  Set parentObj = GetTaskParent(tsk)
  Debug.Print TypeName(parentObj)
End Sub

PercentComplete Property

Function TaskPercentComplete(tsk As Outlook.TaskItem, _
    Optional pct As Variant) As Long
' get or set % complete

  If Not IsMissing(pct) Then
    ' set value
    tsk.PercentComplete = pct
  End If

  ' return value, whether changed or not
  TaskPercentComplete = tsk.PercentComplete

End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim pct As Long
  Set tsk = Outlook.CreateItem(olTaskItem)
  pct = TaskPercentComplete(tsk)
End Sub

Recipients Property

Function GetTaskRecipients(tsk As Outlook.TaskItem) As Outlook.Recipients
  Set GetTaskRecipients = tsk.Recipients
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim recips As Outlook.Recipients
  Set tsk = Outlook.CreateItem(olTaskItem)
  Set recips = GetTaskRecipients(tsk)
End Sub

ReminderOverrideDefault Property

Function TaskReminderOverrideDefault(tsk As Outlook.TaskItem, _
    Optional override As Variant) As Boolean
' set or get task reminder override default

  If IsMissing(override) Then
    ' return current value
    TaskReminderOverrideDefault = tsk.ReminderOverrideDefault
  Else
    ' set value
    tsk.ReminderOverrideDefault = override
    TaskReminderOverrideDefault = override
  End If

End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim isReminderDefaultOverridden As Boolean
  Set tsk = Outlook.CreateItem(olTaskItem)
  isReminderDefaultOverridden = TaskReminderOverrideDefault(tsk)
End Sub

ReminderPlaySound Property

Function TaskReminderPlaySound(tsk As Outlook.TaskItem, _
    Optional playSound As Variant) As Boolean
' set or get task reminder play sound

  If IsMissing(playSound) Then
    ' return current value
    TaskReminderPlaySound = tsk.ReminderPlaySound
  Else
    ' set value
    tsk.ReminderPlaySound = playSound
    TaskReminderPlaySound = playSound
  End If

End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim playSound As Boolean
  Set tsk = Outlook.CreateItem(olTaskItem)
  playSound = TaskReminderPlaySound(tsk)
End Sub

ReminderSet Property

Function TaskReminderSet(tsk As Outlook.TaskItem, _
    Optional setReminder As Variant) As Boolean
' set or get task reminder set

  If IsMissing(setReminder) Then
    ' return current value
    TaskReminderSet = tsk.ReminderSet
  Else
    ' set value
    tsk.ReminderSet = setReminder
    TaskReminderSet = setReminder
  End If

End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim isReminderSet As Boolean
  Set tsk = Outlook.CreateItem(olTaskItem)
  isReminderSet = TaskReminderSet(tsk)
End Sub

ReminderSoundFile Property

Function TaskReminderSoundFile(tsk As Outlook.TaskItem, _
  Optional filePath As String) As String
' get or set reminder sound file path
  If Len(filePath) > 0 Then

    ' make sure filepath is valid
    If Len(Dir(filePath)) > 0 Then
      ' set filepath
      tsk.ReminderSoundFile = filePath
      TaskReminderSoundFile = filePath
    Else
      TaskReminderSoundFile = tsk.ReminderSoundFile
    End If
  Else
    ' return filepath
    TaskReminderSoundFile = tsk.ReminderSoundFile
  End If

End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim soundFilePath As String
  Set tsk = Outlook.CreateItem(olTaskItem)
  soundFilePath = TaskReminderSoundFile(tsk)
End Sub

ReminderTime Property

Function TaskReminderTime(tsk As Outlook.TaskItem, _
    Optional dteReminder As Date) As Date
' get or set reminder time

  If dteReminder <> #1/1/4501# Then  ' it was specified
    ' set value
    tsk.ReminderTime = dteReminder
  End If

    ' return value
    TaskReminderTime = tsk.ReminderTime

End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim reminderDate As Date
  Set tsk = Outlook.CreateItem(olTaskItem)
  reminderDate = TaskReminderTime(tsk)
End Sub

ResponseState Property

Function GetTaskResponseState(tsk As Outlook.TaskItem) As OlTaskResponse
  GetTaskResponseState = tsk.ResponseState
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim resp As OlTaskResponse
  Set tsk = Outlook.CreateItem(olTaskItem)
  resp = GetTaskResponseState(tsk)
End Sub

Role Property

Function TaskRole(tsk As Outlook.TaskItem, Optional roleText As String, _
                  Optional append As Boolean = False) As String
' get or set task role

  If Len(roleText) > 0 Then
    If append Then
      tsk.Role = tsk.Role & roleText
    Else
      tsk.Role = roleText
    End If
  End If

  ' return whether updated or replaced or just checking value
  TaskRole = tsk.Role

End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim taskRole As String
  Set tsk = Outlook.CreateItem(olTaskItem)
  taskRole = TaskRole(tsk)
End Sub

Saved Property

Function GetTaskSaved(tsk As Outlook.TaskItem) As Boolean
  GetTaskSaved = tsk.Saved
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim isSaved As Boolean
  Set tsk = Outlook.CreateItem(olTaskItem)
  isSaved = GetTaskSaved(tsk)
End Sub

Sensitivity Property

Function TaskSensitivity(tsk As Outlook.TaskItem, _
    Optional sens As OlSensitivity) As OlSensitivity
' get or set task sensitivity

  Select Case sens
    Case olConfidential, olNormal, olPersonal, olPrivate
      ' set value
      tsk.Sensitivity = sens
      TaskSensitivity = sens
    Case Else
      ' return value
      TaskSensitivity = tsk.Sensitivity
  End Select

End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim taskSensitivity As OlSensitivity
  Set tsk = Outlook.CreateItem(olTaskItem)
  taskSensitivity = TaskSensitivity(tsk)
End Sub

Session Property

Function GetTaskSession(tsk As Outlook.TaskItem) As Outlook.NameSpace
  Set GetTaskSession = tsk.Session
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim NS As Outlook.NameSpace
  Set tsk = Outlook.CreateItem(olTaskItem)
  Set NS = GetTaskSession(tsk)
End Sub

Size Property

Function GetTaskSize(tsk As Outlook.TaskItem) As Long
  GetTaskSize = tsk.Size
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim taskSize As Long
  Set tsk = Outlook.CreateItem(olTaskItem)
  taskSize = GetTaskSize(tsk)
End Sub

StartDate Property

Function TaskStartDate(tsk As Outlook.TaskItem, _
    Optional dteStart As Date) As Date
' get or set task start date
  If dteStart <> #1/1/4501# Then  ' it was specified
    ' set value
    tsk.StartDate = dteStart
  End If

  ' return value
  TaskStartDate = tsk.ReminderTime

End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim taskStart As Date
  Set tsk = Outlook.CreateItem(olTaskItem)
  taskStart = TaskStartDate(tsk)
End Sub

Status Property

Function TaskStatus(tsk As Outlook.TaskItem, _
    Optional status As OlTaskStatus) As OlTaskStatus
' get or set task status
  Select Case status
    Case olTaskComplete, olTaskDeferred, olTaskInProgress, _
    olTaskNotStarted, olTaskWaiting
      ' set value
      tsk.status = status
  End Select

  ' return value
  TaskStatus = tsk.status

End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim taskStatus As OlTaskStatus
  Set tsk = Outlook.CreateItem(olTaskItem)
  taskStatus = TaskStatus(tsk)
End Sub

StatusOnCompletionRecipients Property

Function TaskStatusOnCompletionRecipients(tsk As Outlook.TaskItem, _
    Optional nameOrNames As String, _
    Optional append As Boolean = False) As String
' get or set task status on completion recipients

  If Len(nameOrNames) > 0 Then
    If append Then
      ' append names
      tsk.StatusOnCompletionRecipients = tsk.StatusOnCompletionRecipients & nameOrNames
    Else
      tsk.StatusOnCompletionRecipients = nameOrNames
    End If
  End If

  ' return whether updated or replaced or just checking value
  TaskStatusOnCompletionRecipients = tsk.StatusOnCompletionRecipients

End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim taskStatusOnCompletionRecips As String
  Set tsk = Outlook.CreateItem(olTaskItem)
  taskStatusOnCompletionRecips = TaskStatusOnCompletionRecipients(tsk)
End Sub

StatusUpdateRecipients Property

Function TaskStatusUpdateRecipients(tsk As Outlook.TaskItem, _
    Optional nameOrNames As String, _
    Optional append As Boolean = False) As String
' get or set task status update recipients

  If Len(nameOrNames) > 0 Then
    If append Then
      ' append names
      tsk.StatusUpdateRecipients = tsk.StatusUpdateRecipients & nameOrNames
    Else
      tsk.StatusUpdateRecipients = nameOrNames
    End If
  End If

  ' return whether updated or replaced or just checking value
  TaskStatusUpdateRecipients = tsk.StatusUpdateRecipients
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim taskUpdateStatusRecips As String
  Set tsk = Outlook.CreateItem(olTaskItem)
  taskUpdateStatusRecips = TaskStatusUpdateRecipients(tsk)
End Sub

Subject Property

Function TaskSubject(tsk As Outlook.TaskItem, _
    Optional subjectText As String) As String
' get or set task subject

  If Len(subjectText) > 0 Then
    ' set value
    tsk.subject = subjectText
    TaskSubject = subjectText
  End If

  ' return value, whether replaced or just checking value
  TaskSubject = tsk.subject

End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim taskSubj As String
  Set tsk = Outlook.CreateItem(olTaskItem)
  taskSubj = TaskSubject(tsk)
End Sub

TeamTask Property

Function TaskTeamTask(tsk As Outlook.TaskItem, _
    Optional setAsTeamTask As Variant) As Boolean
' get or set team task status

  If Not IsMissing(setAsTeamTask) Then
    ' set value
    tsk.TeamTask = setAsTeamTask
  End If

  ' return value, either updated or just checking value
  TaskTeamTask = tsk.TeamTask

End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim isTeamTask As Boolean
  Set tsk = Outlook.CreateItem(olTaskItem)
  isTeamTask = TaskTeamTask(tsk)
End Sub

TotalWork Property

Function TaskTotalWork(tsk As Outlook.TaskItem, _
    Optional workTotal As Variant) As Long
' get or set task total work value

  If Not IsMissing(workTotal) Then
    ' set value
    tsk.TotalWork = workTotal
  End If

  ' return value, either updated or just checking value
  TaskTotalWork = tsk.TotalWork

End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim workTotal As Long
  Set tsk = Outlook.CreateItem(olTaskItem)
  workTotal = TaskTotalWork(tsk)
End Sub

UnRead Property

Function TaskUnRead(tsk As Outlook.TaskItem, _
    Optional MarkAsRead As Variant) As Boolean
' get or set task unread

  If Not IsMissing(MarkAsRead) Then
    ' set value
    tsk.UnRead = Not MarkAsRead
  End If

  ' return value, either updated or just checking value
  TaskUnRead = tsk.UnRead

End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim isUnRead As Boolean
  Set tsk = Outlook.CreateItem(olTaskItem)
  isUnRead = TaskUnRead(tsk)
End Sub

UserProperties Property

Function GetTaskUserProperties(tsk As Outlook.TaskItem) _
    As Outlook.UserProperties
  Set GetTaskUserProperties = tsk.UserProperties
End Function

Sub Test()
Dim tsk As Outlook.TaskItem
Dim taskUserProps As Outlook.UserProperties
  Set tsk = Outlook.CreateItem(olTaskItem)
  Set taskUserProps = GetTaskUserProperties(tsk)
End Sub

Site last updated: May 17, 2012

Random Data Generator