The script runs successfully when run in the editor or from the command line while logged on to the server. When logged off and called from another application, it returns an 'Object Required' error.
strSubject is passed to the script as an argument and script returns 1 if email subject is found or 0 if not.
Any assistance is appreciated.
----------------------------
Const olFolderInbox = 6
Set olApp = CreateObject("Outlook.Application")
Set olns = olApp.GetNameSpace("MAPI")
Set objFolder = olns.GetDefaultFolder(olFolderInbox)
Set myItems = objFolder.Items
intStatus = 0
For iCount = 1 To myItems.Count
Set MyItem = MyItems(iCount)
If myItem.Subject = strSubject then
intStatus = 1
Exit For
End if
Next
WScript.Quit intStatus
--------------------------------
strSubject is passed to the script as an argument and script returns 1 if email subject is found or 0 if not.
Any assistance is appreciated.
----------------------------
Const olFolderInbox = 6
Set olApp = CreateObject("Outlook.Application")
Set olns = olApp.GetNameSpace("MAPI")
Set objFolder = olns.GetDefaultFolder(olFolderInbox)
Set myItems = objFolder.Items
intStatus = 0
For iCount = 1 To myItems.Count
Set MyItem = MyItems(iCount)
If myItem.Subject = strSubject then
intStatus = 1
Exit For
End if
Next
WScript.Quit intStatus
--------------------------------