• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 356
  • Last Modified:

Create an Outlook task from a command line

We currently use "BLAT" to create e-mails from a DOS batch file. I would like to know if there are any similar utilities that will allow me to create an Outlook task from a command line ?
1 Solution
hi IanRBrooks

save this vbscript in a textfile named createOLtask.vbs

'------------------begin script---------------------
Set objArgs = WScript.Arguments
Dim objOutlook, itmtask, tmpbody, bodylen, body

Const olTaskItem = 3

Set objOutlook = CreateObject("Outlook.application")
Set itmTask = objOutlook.CreateItem(olTaskItem)

For each strArg in objArgs
     subject = (strArg)
     tmpBody = tmpBody & (strArg) + chr(32)

bodylen = instr(1,tmpBody,subject,1)
body = mid(tmpBody,1,bodylen-1)
itmTask.Subject = subject
itmtask.body = body

Set itmTask = Nothing
Set objOutlook = Nothing
'---------------------end script---------------------

you wrote, that you would create the task with a batchfile, so start this script with following parameters:

c:\>createOLtask.vbs some text, some more text ThisIsToDo

this will create you an outlook task with the Subject "ThisIsToDo" (last parameter) and with the body "some text, some more text" (everything before the last parameter)

hope you understand by bad english :-)


Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now