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

Choosing an outlook profile from VFP

Status
Not open for further replies.

Simonbegg

MIS
Sep 17, 2002
30
0
0
GB
Hello all,
Can anyone tell me how I can specify which Outlook profile (WORK as opposed to PERS) is used to send an email from VFP.

Thanks in advance

Simon
 
I ought to be more specific.....
We are running a VFP app on a citrix box.
Part of the App sends emails. When a user connects for the first time and tries to send the email Outlook demands that they create an account I.E. Create a profile.

How can I stop this from occuring and forcing outlook to use the.
 

What technique are you using? Most of them allow you to specify a profile.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike,
at the moment just calling an outlook object:

oOutLookObject = CreateObject("Outlook.Application")
oNameSpace=oOutLookObject.getnamespace('MAPI')
oNameSpace.logon(Outlook,,false,true)
oEmailItem = oOutLookObject.CreateItem(0)

The oNameSpace.logon(Outlook,,false,true) line forces the use of the profile called "outlook", but if this is the first time the user has connected to the terminal server then this profile doesnot exist for them, and they are ask to create one.

Cheers
Simon
 
You can really create a profile through code (well you could, but the registry hacks this would require would be astounding). You can however use the CIW and CMW to generate a default profile. I don't know if this is what you are trying to do or not, but it kind of sounds like it. Here's some more info:
boyd.gif

[sub]craig1442@mchsi.com[/sub][sup]
"Whom computers would destroy, they must first drive mad." - Anon​
[/sup]
 
SimonBegg

The following will allow you to choose a profile using CDO (Mapi)

Code:
oSession = CreateObject("MAPI.Session")
oSession.Logon() && This will bring up the profile chooser
oNewMessage=oSession.Outbox.messages.add()
oNewMessage.Subject = "This is an e-mail using CDO"
oNewMessage.Text = "Welcome to the world of CDO"
oNewMessage.DeliveryReceipt = .T. &&Optional, forces a receipt send back
oRecipient = oNewMessage.Recipients.Add()
oRecipient.Name = "John Doe" && This name must appear in your address book.
oRecipient.Resolve && If name does not appear this will cause an error.
oNewMessage.Update()
oNewMessage.Send(1,0,0) && The 1 will save a copy of the message in your sent items folder of Outlook.
oSession.Logoff()


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
You can really create a profile through code..."

should have read "You CAN'T really create a profile through code..."

boyd.gif

[sub]craig1442@mchsi.com[/sub][sup]
"Whom computers would destroy, they must first drive mad." - Anon​
[/sup]
 

Or perhaps this : (Path may vary depending on the installation)
Code:
oShell = CreateObject('WScript.Shell')
oShell.Run('Control.exe "C:\Program Files\Common Files\SYSTEM\MSMAPI\1033\mlcfg32.cpl",,1')


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top