Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Outlook interface not working
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01314751
Message ID:
01315150
Views:
32
Hi Peter,

>Thanks I'll check that out. What does your code do? Is it something you could share?

Good question. Now that you asked I looked at a different program of mine, and I use a different technique to get the Outlook Item from an ID. What the code does is a long story, not sure if it is of any interest, but there it goes. What my code does is using one Outlook Account to give an EMail-like client to some of our users. These are users that have a generic login into our system for they share the computer and the programs they use; for example, the stores persons are concurrently using the same computer(s) and program(s) to check in/out items from the store, so they share a special login name (lets say STORES) and whenever they do a transaction they just enter a secret PIN to individualize them and this works quite well (and the same for others, like for example mechanics working on a train where they need to log the work they are doing)

The problem with that approach is that it makes difficult to give them an e-mail account (not impossible, but then there are another non-technical issues, and I do not understand them well enough to explain anyways <g>) while sharing the same login name, so what my program does is have a computer running an E-Mail "Listener", when it receives an e-mail it looks at the subject (originally I wanted to use the catch all account, but the NA did not allow me to do so for it is used by the antivirus/antispam software), and if in the subject there is an employee name or list of names enclosed in <<>> then it checks if that user has an outlook account, and if it has then it forwards the e-mail directly, if it has not, then it creates an internal mail message in a database (including attachments if there are any) and notifies the user (which must be running a VFP client). This does the reverse if the user wants to reply/forward or create a new mail, and is still a proof of concept, we are not using it other than in tests, but it seems to work ok.

Anyways, when you asked the first question I searched the string 'NameSpace' that you were using and found some code similar to yours but for something else that had the Logon() as I said, but now, looking at the code of my EMailServer DLL, I found that to get what you want I use a simpler code.
	protected function getOutlookItem(tcEntryID as String) as Object
		local lcEntryID, loItem, loOutlook
		
		lcEntryID			= Iif(Vartype(tcEntryID) = 'C', Alltrim(tcEntryID), '')
		if Empty(lcEntryID)
			this.LastError		= 'Invalid or missing EntryID, parameter is not optional'
			return null
		endif
		
		try
			loOutlook		= Createobject('Outlook.Application')
			loItem			= loOutlook.Session.GetItemFromID(tcEntryID)
		catch to loException
			this.LastError		= loException.Message
			loItem			= null
		endtry
		
		return loItem
	endfunc	
Well, that is the story, hope it helps.
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform