Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exchange Server connection check?

Status
Not open for further replies.

APS

Vendor
Sep 25, 2000
53
0
0
US
I have a program that at night automatically runs and sends email notifications out. Periodically the exchange server will be down when the program runs and when I come in the morning the annoying outlook message about whether I want to work offline or cancel will be on the screen. My question is is there anyway to check for a connection to the Exchange Server from VFP before outlook does?

Thanks,
Anthony
 
This may work, I'm not sure I can't tested it because I can't take the Exchange server down. :) You can always tweak it to suit your needs though:
Code:
FUNCTION CheckEConn
*... Returns .T. or .F. ...*

DECLARE INTEGER MAPILogon IN mapi32;
   INTEGER ulUIParam, STRING lpszProfileName,;
   STRING lpszPassword, INTEGER flFlags,;
   INTEGER ulReserved, INTEGER @lplhSession

DECLARE INTEGER MAPILogoff IN mapi32;
   INTEGER lhSession, INTEGER ulUIParam,;
   INTEGER flFlags, INTEGER ulReserved

lnSession = 0
lnResult = MAPILogon (0, "Novell Default Settings", .NULL.,;
   0 , 0, @lnSession)

IF lnResult # 0
   WAIT WINDOW "Failed to init" NOWAIT
ELSE
  *... 
ENDIF
=MAPILogoff (lnSession, 0, 0, 0)
RETURN IIF(lnResult = 0, .T., .F.)

NOTE: MAPPILogon changes the default directory, so you will need to SET DEFAULT after this routine.
You may also need to change "Novell Default Settings" to the correct profile if your e:mail app is not already running.

Dave S.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top