Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


OLE and OUTLOOK check mail.

Keywords:    OLE OUTLOOK inbox check mail MAPI

Question:

I was hoping to look at the Inbox in Outlook and check to see if there is new mail.

Do you have any OLE code that can interact with Outlook and check the inbox for new mail?

Answer:

We have a number of scripts that can check mail, an number of ways...

Here is some code the can look at the inbox in Outlook to see if there is any messages....

;***************************************************************************
;** This script will check every ten seconds 
;** for mail in the outlook inbox.
;** NOTE LINES....;remove after debugging
;***************************************************************************

While 1
TimeDelay(10)
display(2,"TO SHUT DOWN SCRIPT","PRESS CTRL BREAK");remove after debugging
GoSub MAILCHEK
endwhile

:MAILCHEK
olFolderInbox=6 ;constant DO NOT CHANGE
MSapp = ObjectOpen ("Outlook.Application")
objNameSpace = MSapp.GetNamespace("MAPI")
objFolder = objNameSpace.GetDefaultFolder(olFolderInbox);  'Access the Inbox
objcount=objFolder.Items
mycount=objcount.Count;checks number of messages in inbox!
if mycount != 0
  Message("MAIL CHECKER","You have messages!!!") 
Else;remove after debugging																	 	
 Message("MAIL CHECK ","YOU DON'T HAVE MESSAGES");remove after debugging
endif																		

return







Article ID:   W13670
Filename:   OLE and OUTLOOK check mail.txt