Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook 2000 1

Status
Not open for further replies.

APS

Vendor
Sep 25, 2000
53
US
Hi

I am attempting to add an item to my inbox in outlook from
VFP. I am using getdefaultfolder(6) (which is the constant for the olFolderinbox). Everything works fine except that it is putting the item in the draft folder and not the inbox. Can anyone help me? If needed a can post part of the code.

Thanks,
Anthony
 
Hi Anthony,

The outlook save method saves new items to the default folder for the item type, which is the Drafts folder for new mail messages. So you simply have to move it after saving.

oOutlook=CreateObject('Outlook.Application')
oNS = oOutlook.GetNamespace("MAPI")
oFolder = oNS.GetDefaultFolder(6)
oMail = oOutlook.CreateItem(0)
oMail.To = "Jon Hawkins"
oMail.Save
oMail.Move(oFolder) Jon Hawkins
 
Thanks Jon that works, but I have to more questions. My from is blank and the received is defaulting to the current system date and time. Is it possible to put in a received date and a from? I have tried both SenderName and ReceivedTime but I get a message that the property is read-only.

Thanks again
Anthony
 
Why dont you actually create a message and send it, so that it's actually a received email? ISO, attempting to deceive the user by moving an outgoing message to his/her Inbox.

AFAIK, SenderName & ReceivedTime are protected properties that only the server can write to when the mail is actually sent. Attempting to change these properties, IMO, will prove more difficult than necessary. But if you're interested in exploring that route, read:
Accessing Microsoft Exchange and Outlook Data Using Visual Basic

But I'd suggest you save yourself the headaches, and probable heartache, and send the message as its intended to be sent. Jon Hawkins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top