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 MAPI Choose Folder

 Keywords: Outlook choose Personal folder 

objOutLook = ObjectOpen ("Outlook.Application")
objNameSpace = objOutLook.GetNamespace("MAPI")
;Get all folders
objNSFolders = objNameSpace.Folders('Personal Folders')
objFolders = objNSFolders.Folders
count = objFolders.Count
list = ""  
for xx = 1 to count
   objItem = objFolders.Item(xx)
	name = objItem.name
	list = strCat(list,@tab,name)
	ObjectClose(objItem)
next
folderchosen = AskItemList("folderlist",strtrim(list),@tab,@unsorted,@single)
Message("folder chosen",folderchosen)

;Get specific folders items
objMyFolders = objNSFolders.Folders(folderchosen)
objcount=objMyFolders.Items
mycount=objcount.Count ;checks number of messages 
For xx = 1 to mycount 
  objitem=objMyFolders.Items(xx)
  myText = objitem.Body
  message(" %MyFolder% Message Body #%xx%",mytext)
Next

ObjectClose(objFolders)
ObjectClose(objNSFolders)
ObjectClose(objNameSpace)
ObjectClose(objOutLook)
exit

Article ID:   W15615
File Created: 2003:05:13:11:29:14
Last Updated: 2003:05:13:11:29:14