?
Solved

Outlook/Foxpro error

Posted on 2012-08-22
5
Medium Priority
?
417 Views
Last Modified: 2012-09-06
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
0
Comment
Question by:timjshields
  • 3
  • 2
5 Comments
 
LVL 30

Expert Comment

by:Olaf Doschke
ID: 38322729
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
 

Author Comment

by:timjshields
ID: 38324286
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
 
LVL 30

Expert Comment

by:Olaf Doschke
ID: 38325435
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
 

Author Comment

by:timjshields
ID: 38325493
Figured out he solution

lcAccount = loOutlook.ActiveExplorer.Selection[1].ReceivedByName
This will in both OL2007 and OL2010
0
 
LVL 30

Accepted Solution

by:
Olaf Doschke earned 1500 total points
ID: 38325539
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

Featured Post

Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I wanted to share this with fellow Experts, who might not know. How often have you wanted to learn something, only to be set back by either restrictions imposed on "trial" or "evaluation" software?  How often have you had to rebuild a home networ…
The canonical version of this article is on my web site here: http://iconoun.com/articles/collisions/ A companion presentation is available here: http://iconoun.com/articles/collisions/Unicode_Presentation.pdf
Viewers will learn how to maximize accessibility options in an Excel workbook for users with accessibility issues.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question