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.

Outlook Received Date


Question:

I wanna download the attachment from outlook of particular person with todays date. I can do with person but how should I do with todays date. Also can i do with more than one person at a time??

Answer:

;   My mailbox looks like this since I'm off-line:

;Personal Folders   ;<-- top level
;   Deleted Items
;   Inbox
;   Outbox
;   Sent Items
;   Calendar
;   Contacts
;   Journal
;   Notes
;   Tasks
;   Drafts

;   whereever you see  .item(x) you can replace with  .item("Name")

;   Winbatch 2004E and Outlook 2000...

objOutlook = ObjectOpen("Outlook.Application")
oln = objOutlook.GetNameSpace("MAPI")
oln.logon("", "", 0, 1)

MainFolder = oln.Folders.item("Personal Folders") ;<-- top level folder...
LevelOneFolders = MainFolder.folders              ;<-- folders within folders, etc...

Inbox = LevelOneFolders.item("Inbox")             ;<-- Inbox
;message("Debug", Inbox.items.count)

For x = 1 To Inbox.items.count
   Message(Inbox.items(1).subject, Inbox.items(x).ReceivedTime)  ;<-- get the first message
                                                                 ;<-- show subject and date/time received...
   If Inbox.items(x).Attachments.count > 0
      For y = 1 To Inbox.items(x).Attachments.count
         aFilename = Inbox.items(x).Attachments.item(y).Filename
         Message("Attachment %y%", aFilename)
         Inbox.items(x).Attachments.item(y).SaveAsFile(StrCat("c:\MyFolder\", aFilename))
      Next
   EndIf
Next


Exit

Article ID:   W17132
File Created: 2007:07:03:14:28:26
Last Updated: 2007:07:03:14:28:26