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.

TypeOf Equivalent

 Keywords: Data Type TypeOf Equivalent 

Question:

Any idea what vba typeof should be in winbatch?

code sample

objOutlook =
ObjectOpen("Outlook.Application")
mapi = objOutlook.GetNameSpace("MAPI")

objSession = mapi.session
objFolders = mapi.folders
oFld=objsession.pickfolder

ForEach obj In oFld.Items
   truc=ObjectTypeGet (obj) ; answer=DISPATCH
   If TypeOf obj Is Outlook.MailItem Then VBA To be translated...

Answer:

There is no direct equivalent in WB. I recommend using the DefaultItemType Property to determine what type of object you are dealing with.
objOutlook = ObjectCreate("Outlook.Application")
objMapi = objOutlook.GetNameSpace("MAPI")
objSession = objMapi.Session
oFld = objSession.Pickfolder
type = oFld.DefaultItemType
Switch type
   Case 0 ;olMailItem
     typename = "Mail Item"
   Break
   Case 1 ;olAppointmentItem
     typename = "Appointment Item"
   Break
   Case 2 ;olContactItem
     typename = "Contact Item"
     Break
   Case 3 ;olTaskItem
     typename = "Task Item"
   Break
   Case 4 ;olJournalItem
     typename = "Journal Item"
   Break
   Case 5 ;olNoteItem
      typename = "Note Item"
   Break
   Case 6 ;olPostItem
      typename = "Post Item"
   Break
   Case 7 ;olDistributionListItem
          typename = "Distribution List Item"
   Break
   Case type
       typename = "UNKNOWN"
   Break

EndSwitch
Pause("Type",typename)

oFld = 0
objSession = 0
objMapi = 0
objOutlook = 0
Exit

Reference:
http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/OLE~COM~ADO~CDO~ADSI~LDAP/OLE~and~Outlook+Identify~Outlook~Folder~Type~or~Contents.txt


Article ID:   W18095
Filename:   TypeOf Equivalent.txt
File Created: 2014:07:18:09:51:38
Last Updated: 2014:07:18:09:51:38