WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE and Outlook
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

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
File Created: 1999:04:15:16:55:36
Last Updated: 1999:04:15:16:55:36