Outlook and VFP  
Author Message
Emrys





PostPosted: Wed May 12 07:09:08 CDT 2004 Top

Exchange Servers >> Outlook and VFP

Hi group,

following scenario: I use Outlook as a COM Server. The user copies for
example 3 mails in outlook in the clipboard, and wants to make an action on
them in VFP. So, I have to know in VFP, which mails are in the clipboard.
I tried it with VFP tools, no success, I tried the API, (dragqueryfile,
OpenClipboard, ....), no success.
Does anybody can help me?

Bastien

Exchange Server39  
 
 
Eric





PostPosted: Wed May 12 07:09:08 CDT 2004 Top

Exchange Servers >> Outlook and VFP Hello, Bastien!
You wrote on Wed, 12 May 2004 13:51:36 +0200:

BP> following scenario: I use Outlook as a COM Server. The user copies for
BP> example 3 mails in outlook in the clipboard, and wants to make an
BP> action on them in VFP. So, I have to know in VFP, which mails are in
BP> the clipboard. I tried it with VFP tools, no success, I tried the API,
BP> (dragqueryfile, OpenClipboard, ....), no success.
BP> Does anybody can help me?

If you copy one or more mail items from for example the inbox to the
clipboard, Outlook stores the following information in _clipboard:

From Subject Received
Eric den Doop RE: hello world Wed 12-May-04 12:28 PM
Bastien Piroue Bug Wed 12-May-04 11:10 AM

If you like, you can specify other columns by choosing these in Outlook. You
can use this information to find the messages in the mailbox
programmatically.

Personally, I'd rather retrieve all required email information from Outlook
programmatically and display the info in my own user interface, giving me
more control. Just a thought.
--
Eric den Doop
www.foxite.com - The Home Of The Visual FoxPro Experts - Powered By VFP8


 
 
Bastien





PostPosted: Wed May 12 07:41:34 CDT 2004 Top

Exchange Servers >> Outlook and VFP Hello Eric

> If you like, you can specify other columns by choosing these in Outlook.
You
> can use this information to find the messages in the mailbox
> programmatically.

I know, I'm not sure if this is a good solution: It depends on what our
client has configured in Outlook, I won't rely on this during my search...
And, I don't know in which folder the mails are, so I have to search within
possibly tons of data, thus being very slow...
>
> Personally, I'd rather retrieve all required email information from
Outlook
> programmatically and display the info in my own user interface, giving me
> more control. Just a thought.

:-), I don't know if our clients will accept a second Outlook application,
written in VFP? I think not, and I think this is not the goal of COM
Automation....

Hm, I am able to read all the filenames which I copied in the clipboard from
the explorer, why isn't it possible to do similar with mails?

Bastien


 
 
Eric





PostPosted: Wed May 12 07:48:34 CDT 2004 Top

Exchange Servers >> Outlook and VFP Hello, Bastien!
You wrote on Wed, 12 May 2004 14:41:34 +0200:

??>> Personally, I'd rather retrieve all required email information from
Outlook
??>> programmatically and display the info in my own user interface, giving
??>> me more control. Just a thought.

BP> :-), I don't know if our clients will accept a second Outlook
BP> application, written in VFP? I think not, and I think this is not the
BP> goal of COM Automation....

Why do you think that's not the goal of COM automation? I wasn't saying you
should create a VFP-version of Outlook. What I meant was you can use OLE
Automation to retrieve the information you need. You then display that info
in your own UI, so that the user can select the messages that need to be
processed from within the application that is processing the emails. Hope
this makes sense.

BP> Hm, I am able to read all the filenames which I copied in the clipboard
BP> from the explorer, why isn't it possible to do similar with mails?

I think that's just the way Outlook and Explorer are designed.
--
Eric den Doop
www.foxite.com - The Home Of The Visual FoxPro Experts - Powered By VFP8


 
 
Eric





PostPosted: Thu Jul 08 13:09:25 CDT 2004 Top

Exchange Servers >> Outlook and VFP Hello, George!
You wrote on Thu, 8 Jul 2004 08:33:02 -0700:

Gic> Do you have any code snippets on how to do this Eric? Its an item on
Gic> my project list.

Here's some code I googled from our website archives. While it isn't
perfect, it can give you an idea and with a little help of IntelliSense, you
can learn about the Outlook model fast.
<vfp_code>
LOCAL objSession AS MAPI.Session
LOCAL objCDOMsg AS MAPI.Message
LOCAL objAddEntry AS MAPI.AddressEntry
LOCAL objField AS MAPI.Field
LOCAL objMsg AS Outlook.MailItem
LOCAL lcEntryID AS String
LOCAL lcStoreID AS String
LOCAL lcAddress AS String
LOCAL lcField AS String
LOCAL oOutlook AS Outlook.Application
LOCAL oNameSpace AS Outlook.NameSpace
LOCAL oMyFolder AS Outlook.Folders

oOutlook = CREATEOBJECT("Outlook.Application")
objSession = CREATEOBJECT("MAPI.Session")
objSession.Logon(,,,.F.) && NewSession := False
oNameSpace = oOutlook.GetNamespace("MAPI")
oMyFolder = oNameSpace.GetDefaultFolder(6) && Inbox
objMsg = oMyFolder.Items(2)
lcEntryID = objMsg.EntryID
lcStoreID = objMsg.Parent.StoreID
objCDOMsg = objSession.GetMessage(lcEntryID,lcStoreID)
objAddEntry = objCDOMsg.Sender

IF objAddEntry.Type = "EX"
objField = objAddEntry.Fields(-2146496482) && &H800F101E
FOR EACH lcField IN objField.Value
IF LEFT(lcField,5) = "SMTP:"
lcAddress = SUBSTR(lcField,6)
? lcAddress
EXIT
ENDIF
ENDFOR
ELSE
? objAddEntry.Address
ENDIF

objSession.Logoff
objSession = .NULL.
objAddEntry = .NULL.
objCDOMsg = .NULL.
objMsg = .NULL.
objField = .NULL.
oNameSpace = .NULL.
oMyFolder = .NULL.
oOutlook = .NULL.
</vfp_code>
--
Eric den Doop
www.foxite.com - The Home Of The Visual FoxPro Experts - Powered By VFP8