An overview of how to automate Outlook with Visual FoxPro.
This white paper is from a session originally given at Southwest Fox 2008, introducing many developers to how CodePlex works and how they can get involved with the VFPX Project. You can also hear the audio of this session here . So you want to help out in VFPX? This session goes through how to get started with the VFPX Project and dealing with issues like source control, the Wiki-style attitude of Codeplex and more. What Is VFPX? VFPX is the future of the Visual FoxPro IDE and developer tools we currently know today. It is based on the VFP 9 SP2 core but realistically, it is more like taking all of the tools that have grown up around the VFP engine and making them ours to grow and enhance. Microsoft is no longer doing active development on Visual FoxPro; the product is officially supported until 2015 but then many developers still have VFP 6 applications running and VFP6 support ended in 2004. Visual FoxPro has a long running tradition of community enhancements. Back in 1990, the
Comments
Ideas?
Ideas?
Can you tell me the difference in what you've outlined in your white paper where you write:
loApp = CREATEOBJECT("OUTLOOK.APPLICATION")
loSpace = loApp.GetNameSpace("MAPI")
loFolders = loSpace.Folders
loItems = loSpace.Folders.Items
and the follwing:
LOCAL loOutlook, loHandler
loOutlook=CREATEOBJECT( [Outlook.Application] )
loHandler=NEWOBJECT("OutlookHandler")
EVENTHANDLER( loOutlook, loHandler )
SUSPEND
DEFINE CLASS OutlookHandler AS session OLEPUBLIC
IMPLEMENTS ApplicationEvents_10 IN {00062FFF-0000-0000-C000-000000000046}#9.1
PROCEDURE ApplicationEvents_10_ItemSend(Item AS VARIANT, Cancel AS LOGICAL) AS VOID
* add user code here
ENDPROC
Great question. The main difference is one of how you react to items. The first approach is useful for actively looking for items without worrying about what the user is doing. You aren't told if there are new emails or new items added - it's more if you are adding items automatically or reviewing existing items.
Using the IMPLEMENT approach, you are able to interact with what the user is doing. For example, when a new message comes in, your Outlook handler can react to it automatically. When a user clicks a button, you can react to it further. There's more code required but more available actions to work from.
For example, if your application, wants to react to new messages as they come in, you would need to use the IMPLEMENTS approach.
Make sense?