Question

I have a daily-generated CSV file containing contact data which I want load entries into an Outlook contact file (overwriting the file each time, not appending). I know I can import the CSV file manually, but that's a pain to do every day. Has anyone any ideas how I can automate the process (eg. by running a scheduled batch or exe file)? I am proficient in Python and Visual Foxpro, so if a programming solution is required, either of these languages would be preferable.

Also, I want to ensure that the imported fields are in the correct order. Where can I find a default field-mapping list for the contact file?

Any help would be appreciated.

Alan

Was it helpful?

Solution

If you can import the file manually, you can certainly automate it. With VFP, you'd create an instance of Outlook, instantiate the namespace, and then call on whatever the method is that imports the CSV.

oOutlook = CREATEOBJECT("Outlook.Application")
oNS = oOutlook.GetNameSpace("MAPI")
* You'll probably have to drill in and grab a reference
* to some object before calling whatever the method is

One issue with automating Outlook is that it likes to protect itself from code touching some things and I wouldn't be surprised if Contact records are among those. If this is for your own personal use, you could turn that protection off. The specifics depend on the version. In Outlook 2010, it's File | Options, then Trust Center, then Programmatic Access.

Once you've got code that works, build an EXE, and use the Windows Task Scheduler to run it daily.

Tamar

OTHER TIPS

There is a csv module in Python: http://docs.python.org/library/csv.html It allows you to handle csv files painlessly.

However, since you didn't specify the format of the Outlook file, there is nothing more I can do for you. You should clarify how the output should look like, maybe with a good example, and then we yould work on it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top