Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Opening forwarded messages in Outlook via OLE
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00324516
Message ID:
00325382
Views:
21
Thanks John, this works great. However, I've encountered another hurdle. The main reason for getting to these items is to get the email address. I thought I'd get this by having access to the oMailItem.SenderName property. The problem is the SenderName will often be the person's name instead of their email address. In Outlook you'd right click on the From: John Petersen and choose properties to get a form with the actual email address. I've been looking at the object model at http://msdn.microsoft.com/isapi/msdnlib.idc?theURL=/library/officedev/off2000/oltocobjectmodelapplication.htm but I haven't figured out how to get this form or it's properties programatically. The form looks like it might be a contact item object.

Thanks again for your help. I used your ROC program to get my feet wet with Outlook.

Regards,

E.R. Gilmore

>If you got as far as accessing the attachment, I will start from there....
>
>*/ Save the attachment as a file.
>oMailItem.Attachments.item(1).saveasfile(oMailItem.Attachments.item(1).FileName)
>
>Now, here is where it gets tricky.. How the heck do you open the MSG file? Believe it or not, it is not as simple as creating a mail item, and then invoking an Open Method. There is no Open Method anywhere in the Outlook Object Model.. < s >.
>
>Anyway, once you have the attachment saved, you can then use IE to open the MSG file:
>
>oie = createobject("internetexplorer.application")
>oie.navigate(oMailItem.Attachments.item(1).FileName)
>*/ We don't need IE anymore...
>oie.quit
>
>
>This will cause the saved attachment to become the active element in Outlook. Outlook has a neat method called ActiveInspector, which returns an Inspector Object. The Inspector Object in turn,has an object called currentitem, which is the mail item we just opened.
>
>Assuming your outlook instance is called oOutlookObject, the following code will allow you to peek inside the mail item:
>
>oInspector = oOutlookObject.ActiveInspector
>oMailItem = oInspector.CurrentItem
>?oMailItem.Subject
>?oMailItem.Body
>
>Finally, when you are ready to close the item down, you can use this code:
>
>oMailItem.Close(0)
>
>
>Here is some sample code that starts the process and takes it to the end:
>
>
>oInspector = Null
>oOutLookObject = CreateObject("Outlook.Application")
>oIE = Createobject("internetexplorer.Application")
>olNameSpace = oOutlookObject.GetNameSpace("MAPI")
>oFolder = olNameSpace.Folders("Personal Folders").Folders("test")
>oItem = oFolder.Items(1)
>If File("c:\temp\"+oItem.Attachments.item(1).FileName)
>   Erase ("c:\temp\"+oItem.Attachments.item(1).FileName)
>Endif
>oItem.Attachments.item(1).saveasfile("c:\temp\"+oItem.Attachments.item(1).FileName)
>oIE.Navigate("c:\temp\"+oItem.Attachments.item(1).FileName)
>Do While .T.
>   oInspector = oOutlookObject.ActiveInspector
>   If !IsNull(oInspector)
>      Exit
>   Endif
>EndDo
>oMailItem = oInspector.CurrentItem
>?oMailItem.Subject
>?oMailItem.Body
>oMailItem.Close(0)
>
>
>Let me know how things work out!!
>
>
>
>
>
>>When a email message gets forwarded in Outlook it is received as an attachment. Is there a way to get mail item properties from a forwarded message? I can access the attachment via OLE but I can't get any of the mail item propeties.
>>
>>
>>TIA,
>>
>>E.R. Gilmore
Regards,

E.R. Gilmore
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform