MAPI Namespace context is different in task scheduler 
Author Message
 MAPI Namespace context is different in task scheduler

I am trying to run a VB6 app that maniuplates custom ContactItems in Win2000
Scheduled Tasks.  It's an unattended app that runs correctly when I invoke
it from a command prompt or just dbl-click the exe.  But when I run it in a
schedulted task (either directly, batch file, using either START or cmd.exe
/c) the namespace is not the same as when I do it manually.  The error is
below, on the last line of this code sippet:

    Set objOL = CreateObject("Outlook.Application")
    Set objNS = objOL.GetNamespace("MAPI")
    Log "... namespace user is " & objNS.CurrentUser

Last line incurs this error in Sched. Tasks:

 Microsoft Outlook -2079063806 Could not complete the operation because the
service provider does not support it.

Manually, it returns my name in the log.
What can I do to run it?
Richard



Sun, 16 Jan 2005 23:51:01 GMT  
 MAPI Namespace context is different in task scheduler
Solved: in case anyone needs it: you must explicitly log on, by calling the
Logon method of the Session property (which is MAPI.Session class) of the
Outlook.Application object.

Richard



Quote:
> I am trying to run a VB6 app that maniuplates custom ContactItems in
Win2000
> Scheduled Tasks.  It's an unattended app that runs correctly when I invoke
> it from a command prompt or just dbl-click the exe.  But when I run it in
a
> schedulted task (either directly, batch file, using either START or
cmd.exe
> /c) the namespace is not the same as when I do it manually.  The error is
> below, on the last line of this code sippet:

>     Set objOL = CreateObject("Outlook.Application")
>     Set objNS = objOL.GetNamespace("MAPI")
>     Log "... namespace user is " & objNS.CurrentUser

> Last line incurs this error in Sched. Tasks:

>  Microsoft Outlook -2079063806 Could not complete the operation because
the
> service provider does not support it.

> Manually, it returns my name in the log.
> What can I do to run it?
> Richard



Mon, 17 Jan 2005 02:15:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Add a task to task scheduler

2. W2k Task-Scheduler -> find hanging tasks

3. Setting Username and Passwords for a scheduled task in MS Task Scheduler

4. How to add a task into Windows Task Scheduler from VB

5. Adding tasks to WIN95/98 Task Scheduler

6. Creating Tasks in Task scheduler

7. How to create TASK SCHEDULER tasks

8. Adding tasks to WIN95/98 Task Scheduler

9. Different What's this context ids for different tabs

10. obj.Logon with MAPI namespace

11. Calling Task Scheduler Object from VBA

12. VBA call to Windows Task Scheduler

 

 
Powered by phpBB® Forum Software