Creating a new TASK using VFP9.0

  • Thread starter Thread starter bbettsack
  • Start date Start date
B

bbettsack

I know this is a VBA group but I can't seem to get an answer from the VFP
group on this subject. I need to create a new TASK and send it to the person
I pick from a drop-down menu. This has to be done in FOXPRO (VFP9.0-SP2). I
can get to Outlook and create/send an email, but I can not figure out how to
create/send a TASK. Any help/sample code will be great.

Thanks in advance
 
I don't have a clue as to how you'd do it in VFP, but if you are using the
CreateItem() method with an olMailItem argument to create a mail item
substitute the olTaskItem enum member instead.

From there you need to add various properties before you call the Assign()
method of the task. See the VBA object browser help for TaskItem.Assign to
see how to set what you need using VBA code. You will need to translate that
into VFP code.
 
I figured out the code and am posting it here in case anyone else needs it.

* This program will create a TASK in Outlook (Office 2007)
oOutlook = CreateObject('Outlook.Application')
oNameSpace = oOutlook.GetNameSpace('MAPI')
oNameSpace.Logon()
loItem = oOutlook.CreateItem(3)

#DEFINE CR CHR(13)
WITH loItem
.Subject = 'New Task - test'
.Body = 'Here is the newest TASK that has been assigned to you.'
.Recipients.Add('user@email_address.com')
.StartDate = '05/01/2010'
.DueDate = '05/15/2010'
.ReminderSet = 1
.ReminderTime = CTOT(SYS(10,reminder_date) + ' 09:00')
ENDWITH

loItem.Save()
loItem.Assign()
loItem.Send()
=MESSAGEBOX('TASK Sent.',64,'Status')
 
Back
Top