|
-
Dec 11th, 2000, 12:54 PM
#1
Thread Starter
New Member
I have a program that is launched by Scheduler on an NT4 server (with Outlook 2000). Outlook only uses one profile and scheduler is set to logon with the UserId that owns that exchange account. The problem is that whenever the program is launched via the scheduler it gives the following error:
"MAPI Failure: valid session ID does not exist"
However, if I run the program while physically logged onto the box it works great.
The logon code that I am using is:
Private Function LogOn() As Boolean
Dim Result As String
Dim HFile As Long
If MapSess.NewSession Then
LogOn = False
Exit Function
End If
On Error GoTo errLogInFail
With MapSess
' Set DownLoadMail to False to prevent immediate download.
.DownLoadMail = False
.UserName = "MS Exchange Settings"
.LogonUI = True ' Use the underlying email system's logon UI.
.SignOn ' Signon method.
' If successful, return True
LogOn = True
' Set NewSession to True and set0
' variable flag to true
.NewSession = True
bNewSession = .NewSession
MapMess.SessionID = .SessionID ' You must set this before continuing.
End With
Exit Function
errLogInFail:
HFile = FreeFile
Open "C:\error.log" For Append Access Write Shared As HFile
Write #HFile, Error
Close HFile
Err = 0
Resume Next
End Function
If anyone has any suggestions it would be greatly appreciated. I need to get this thing working and am getting frustrated!
Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|