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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Synchronizing Outlook, Etc.? 2

Status
Not open for further replies.

Docpro777

Programmer
Jul 1, 2003
105
US
Synchronizing Outlook (hopefully like a PDA) has been a great challenge.

I've reached the point of import/export prototypes only (VFP to/from Outlook), thanks in great part to Mike Gagnon, Ramani, and many of you.

PROBLEM:
Filter syntax for Number fields with 'RESTRICT' nor 'FIND'. (I get parsing errors, etc.)

Character field and Date field syntax work fine: eg.

oCalendarItems=oDefaultFolder.items.Restrict("[Start]>='09/19/03'"). (Note: FoxAdvisor articles did not seem to provide valid syntax concerning number fields, I may be wrong)

Thanks in advance

Philip M. Traynor, DPM
 
DocPro777

Can you explain which Number field you are trying to restrict (or find)?

Can you post the code that doesn't work?

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
In Fox Advisor's "A New Outlook", example was given for a user defined numeric field named BalanceDue (similar to my scenarios):

loFound =
loCustomers.Items.Find("[MailingAddressState]='CA' AND [BalanceDue]>500")

1) I've tried similar this and get the parsing error.
2) Furthermore when I try to do macrosubst in FOR-ENDFOR loops, I can't get ever get the (boolean) combination of character and numeric fields to work.

Thanks for your interest,

Philip M. Traynor, DPM
 
DocPro777

This works for me providing the new field exist in the contacts you are searching for. In order words if you are looking for a contact to which you added a BalanceDue field and inputted the value of 500.00, all the other contact do not have this new field and you are searching for all contacts that have a value of higher then 500.00 and the contacts do not have this new field, it will throw an error. But if you add a "B" BalanceDue field to a single contact and set it to numeric and add a value of 500.00 and use the following, it will do it.
Code:
o=CREATEOBJECT("outlook.application")
oNameSpace=o.getNameSpace("mapi")
oDefaultFolder=oNameSpace.getdefaultfolder(10)
oDefaultFolder.items
myItem=odefaultFolder.Items.Find("[BalanceDue]=500")
myItem.display

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Very well Mike,

If I understand your logic; ALL Outlook contact search items must have a numeric field value in place or the error gets thrown.

Makes perfect sense.

Perhaps I may now see more clearly to work around this dilemma using ...
1) other pre-filters using 'restrict'/'find' commands
2) filtering for object existence ...and/or
3) (various) boolean filters

Presently I've worked around these and other object error errors with TRY-CATCH-ENDTRY routines: where the CATCH searches items the long way: i.e., 'FOR EACH ITEM in ITEMS' (without restrict/find statements)

As always, thanks again for your thoughtful and inspiring input.


Philip M. Traynor, DPM
 
Hello Philip,
I do some import functions from outlook, too at this time.
So I think, I understand your problems. Foxpro can't access to user defined fields until they have a value assigned!
So you must check first if the type is correct.
Somethink like
[tt]IF TYPE(odefaultFolder.Items.Find("BalanceDue").Value="N")[/tt]
Would solve your problem.

Hope this helps

Greetings

Georg Nickel
Software Development
Germany

 
Sorry, it's early in the mornig, the last bracket ist set wrong and some other mistakes...

it must be:

[tt]IF TYPE(odefaultFolder.Items.Find("BalanceDue").Value)="N"[/tt]


Georg Nickel
Software Development
Germany

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top