Send an Outlook Task Through a VB app in background

  • Thread starter Thread starter Rob McCaughey
  • Start date Start date
R

Rob McCaughey

Hi all!

I'm a VB newbie, and trying to send an Outlook Task automatically without
user intervention in a VB application. When I use the following code, if I
enable the send portion (see code below) , I get an error saying "Send is
ambiguous across the inherited interfaces 'Outlook._taskitem' and
Outlook.itemevents.event'.

Any help would be appreciated!

Thanks

Rob
Public Sub SendTask(ByVal in_torecipients As String, ByVal in_subject As
String, ByVal in_body As String, ByVal in_attachmentfilenames As ArrayList)

Dim oTaskItem As Outlook.TaskItem

Dim enumer As IEnumerator

Dim attachment_file As String

oTaskItem =
CType(Me.outlook_application.CreateItem(Outlook.OlItemType.olTaskItem),
Outlook.TaskItem)

enumer = in_attachmentfilenames.GetEnumerator

While enumer.MoveNext

attachment_file = CType(enumer.Current, String)

oTaskItem.Attachments.Add(attachment_file, Type.Missing, Type.Missing,
attachment_file)

End While

oTaskItem.Assign()

oTaskItem.Recipients.Add(in_torecipients)

oTaskItem.Subject = in_subject

' oTaskItem.Owner = System.Environment.UserName

oTaskItem.Body = in_body

oTaskItem.DueDate = DateTime.Today

oTaskItem.ReminderSet = True

oTaskItem.ReminderTime = oTaskItem.DueDate

oTaskItem.Display(True)

' oTaskItem.Save()

'oTaskItem.Send() <- this is where the error occurs.

End Sub
 
Back
Top