Link to home
Start Free TrialLog in
Avatar of werddrew
werddrew

asked on

Automatically Accept Assigned Tasks

Here's the situation:

Outlook 2003 WITH an Exchange server.

My office has a shared task list.  Users can assign tasks to this "dummy" account and select individuals have the ability to enter into this task list and re-assign the tasks to the appropriate individual.

Right now, when a user assigns a task to the "dummy" account, it sits in the inbox and isn't accepted until one of the few who have full access to the account logs in and accepts them all.  This is a useless step, seeing as this account will NEVER reject a task.

I know how to set up an account to automatically accept meetings, and this is NOT what my question is about.  All I need is a way for the account to automatically accept TASKS.

As a bonus, if I'd also love to know if it could automatically process task updates as well.

Thanks!
Avatar of David Lee
David Lee
Flag of United States of America image

Hi werddrew,

The former is possible via an Outlook macro.  I'm not sure about the latter, but can run a simple test to find out.  However, doing this will require leaving Outlook open and running on a computer that's left on all the time.  An alternative would be to write a small Visual Basic program that'd do this.  If either of those are options, then I can provide the macro/program.

Cheers!
Avatar of werddrew
werddrew

ASKER

Would both options require Outlook to be running at all times?  Could I load it say, once a week and have the program accept them all at once?  I believe the scheduling meeting will occur weekly, but I'm not sure.

Wish it were easier, but it's not looking that way...
If you only need to do this once a week, then we could do it with a bit of VBScript that you could run via the task scheduler.  The only two requirements would be that Outlook is installed on the computer and that you'd created a valid Outlook profile that the script could use.  Of course the computer would have to be on a the time too.  Would that work?
Ya know, that could work...  How complex of a script are we talking here?
I don't think it it'll be very complex.  I'll put it together and post it as soon as I can (next 24 hours or so).
Ok, I believe this will automatically accept the tasks.  I say "believe" because I'm not in a position to test it at the moment.  To use this all you need to do is copy the code and paste it into Notepad.  Then save the file with a .vbs extension.  When you run the script it should process, accept, all open task requests.  I'll test the code myself as soon as I can, but that may not be until Tuesday.

    Dim olkTaskFolder, objItem, olkTaskRequest, olkTask
    Set olkTaskFolder = Application.GetNamespace("MAPI").GetDefaultFolder(13)
    For Each objItem In olkTaskFolder.Items
        If objItem.Class = olTaskRequest Then
            Set olkTaskRequest = objItem
            Set olkTask = olkTaskRequest.GetAssociatedTask(True)
            olkTask.Respond olTaskAccept, True, False
            olkTask.Send
        End If
    Next
    Set objItem = Nothing
    Set olkTaskFolder = Nothing
    Set olkTaskRequest = Nothing
    Set olkTask = Nothing

It looks spectacular, I won't have the chance to implement until Tuesday anyway.  You'd probably be able to more accurately debug than I anyway.

I seriously appreciate the effort you're putting into this.  Especially seeing as you're apparently working on every other question in this topic area.  :)
Thanks.  I'll test it and let you know.  

> seeing as you're apparently working on every other question in this topic area
It's my hobby.
ASKER CERTIFIED SOLUTION
Avatar of David Lee
David Lee
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
BlueDevilFan,

How would you keep that script from prompting with the security question about 'a program is trying to access your email' and 'a program is trying to send mail on your behalf'?

Also, the script fails on certain tasks (i can't see what's different about them) with the error

Line 10
Char 9
Error: "the task "This is a test" cannot be sent. It may be an attachment of another message.
Code: 80004005
> How would you keep that script from prompting with the security question
There are three ways to handle this.  In no particular order:

1.  Use ClickYes (http://www.contextmagic.com/express-clickyes/).  This utility sits in the system tray and clicks the Yes button for you each time the security dialog-box appears.

2.  Use Outlook Redemption (http://www.dimastr.com/redemption).  This DLL circumvents Outlook security and eliminates that security warning.

3.  Convert the code into an Outlook add-in.  Add-ins have different security rules.


> Also, the script fails on certain tasks
I'll see if I can duplicate the problem.  
What's different about the tasks that cause the error from those that don't.  Or do they all cause this error?
I accepted the answer because it does the best job of anything I've been able to find.  I might swing back to hit you up for some more help though.

Thanks!  
You're welcome.  I'll be glad to help any time I can.  My email address is in my profile.  You're welcome to send me a message asking me take a look at a question.
Were to you intergrate this the Server our a PC.  is it ready to run right out of the box our do you have to configure the code for your needs?
Hi, techguyjohn.

The code can run from any computer that has Outlook installed and includes a profile with access to the mailbox receiving the tasks.  It is ready to run out of the box so long as this is a standard mailbox (e.g. not using multiple task folders).
I am getting an error after the security warning.

Script:C:\documents and settings\user\desktop\test.vbs
Line:10
Char:9
Error:The task "test" cannot be sent. It may be an attachment of another message.
Code:80004005
Source:Microsoft Office Outlook