Outlook/Foxpro error

I have an VFP 9 app that calls in parameters from an outlook email.

The problem is I have two different versions of Outlook
one is 2007 the other is 2010

The following line won't work in 07 but will work in 10
loAccount = looutlook.ActiveExplorer.AccountSelector.Parent

any ideas ti make this work in 07
timjshieldsAsked:
Who is Participating?
 
Olaf DoschkeConnect With a Mentor Software DeveloperCommented:
If I select a mail from the sent items, ReceivedByName is empty. "To" will give me the receiver for any mail item, also my own mail address for inbox.

But if ReceivedByName works for you that's fine.

Bye, Olaf.
0
 
Olaf DoschkeSoftware DeveloperCommented:
If Parent has the same meaning in the outlook object model, and I think it has, then this would be the same as looutlook.ActiveExplorer only.

Do you address thisform.grid1 as that or rather as thisform.grid1.column1.parent?

It may simply be OL2007 doesn't have the AccountSelector. But in OL2010  looutlook.ActiveExplorer.AccountSelector.Parent seems the same as looutlook.ActiveExplorer. COMPOBJ returns .F., but that may be due to these objects being COM objects.

What's the bigger picture? What are you trying to accomplish?

Bye, Olaf.
0
 
timjshieldsAuthor Commented:
We are trying to retrieve the received by name.

Below is the VFP code.

** Outlook Properties: http://msdn.microsoft.com/en-us/library/aa271708(v=office.11).aspx
_SCREEN.WINDOWSTATE = 2

CLOSE DATABASES


loOutlook = GETOBJECT(,"outlook.application")

IF loOutlook.ActiveExplorer.SELECTION[1].CLASS != 43 && Must be 43 (mail item)
   * WAIT WINDOW "ERROR: Not a mail item. Can not load a feed from here." TIMEOUT 3
   RELEASE loOutlook
   RETURN .F.
ENDIF



*--------------------------------------------------------------------------*
* Get the folder name that the requested email to load is located in.
* Set up beta flag based on folder name.
*--------------------------------------------------------------------------*
lcFolder   = UPPER(ALLTRIM(loOutlook.ActiveExplorer.CurrentFolder.NAME))

*
* Code to find email account
*
*** THE FOLLOWING LINE CRASHES ON 07 BUT WORKS IN 10
loAccount = looutlook.ActiveExplorer.AccountSelector.Parent
*
0
 
Olaf DoschkeSoftware DeveloperCommented:
As loOutlook.ActiveExplorer.SELECTION[1] is the mail item, doesn't loOutlook.ActiveExplorer.SELECTION[1].To give you that information?

Besides, in OL2010 I can execute loAccount = o.ActiveExplorer.AccountSelector.Parent without error, but it doesn't give an account object at all.

Bye, Olaf.
0
 
timjshieldsAuthor Commented:
Figured out he solution

lcAccount = loOutlook.ActiveExplorer.Selection[1].ReceivedByName
This will in both OL2007 and OL2010
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.