Can you generate Outlook tasks using VBScript?

M

mj.redfox.mj

(I hope this isn't a duplicate post, but it didn't appear to submit
when I tried a few minutes ago)

I'm trying to use a VbScript to generate Outlook tasks for Windows
network users. I've been using the following code so far:

dim ol
dim olTask
set ol=createobject("Outlook.Application")
set olTask=ol.CreateItem(3)
with olTask
.DueDate="03/04/2006"
.Subject="Any Subject"
.Body="Any Body"
.Recipients.Add "<Recipient Name>"
.Assign
.send
end with
set ol=nothing
set olTask=nothing


However, If I use this method, I get the following prompt: 'A program
is trying to access e-mail addresses you have stored in Outlook. Do you
want to allow this?'

Only after clicking 'Yes' several times does the process continue.

I was wondering if anyone was able to answer me two questions:

1. Is it possible to somehow get around this prompt and just create the
task without Outlook asking permission? I know that using an add-in
called Outlook Redemption can help with this, but I really need to find
another way without resorting to this?

2. Even when the prompt is accepted, only an Outlook task INVITATION is
created, rather than the task itself. Is there any way of creating a
task using this kind of script, or would it always be an invitation?

Thank you if anyone is able to help!
 
S

Sue Mosher [MVP-Outlook]

1) See http://www.outlookcode.com/d/sec.htm for your options with regard to the "object model guard" security in Outlook 2000 SP2 and later versions.

2) Outlook is doing exactly what you told it to do -- assign a task. If you want to create a task in someone else's Tasks folder, you must have Write permission on that folder and use the Namespace.GetSharedDefaultFolder method to return the folder, then create an item in it with the MAPIFolder.Items.Add method.

FYI, there is a newsgroup specifically for general Outlook programming issues "down the hall" at microsoft.public.outlook.program_vba or, via web interface, at http://www.microsoft.com/office/community/en-us/default.mspx?dg=microsoft.public.outlook.program_vba

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top