View Single Post
  #1  
Old March 11th 08, 02:19 PM posted to microsoft.public.outlook.program_vba
David
external usenet poster
 
Posts: 196
Default Sending appointment not using default profile

Hey all, I've search all the forum, tried many solution, but none of them
works for me

Here's my problem. I'm developping an application in VB6 that must send
appointment using Outlook ( we're using MicrosoftExchange ).

The problem is that i have two profiles bind to my outlook.
1-My regular profiles for my mail ( default ) called : MainProfile
2-The one that need to send all appointments called : AppointmentProfile

Whenever i try to send an appointment, it always use Mainprofile to send it,
even if i specified AppointmentProfile in the logon.

Note that the 'When starting Outlook use this profile' option in Outlook is
pointing at MainProfile in case it matters.

Thanks all for you help!!!

[CODE START HERE]
Dim olApp As outlook.Application
Dim olNs As outlook.NameSpace
Dim olCal As outlook.mapiFolder
Dim mapiSession As mapi.Session

Set olApp = CreateObject("Outlook.Application")
Set olNs = olApp.GetNamespace("MAPI")
Set olCal = olNs.GetDefaultFolder(olFolderCalendar)
Set mapiSession = New mapi.Session

mapiSession.Logon "AppointmentProfile", "", False

Dim olAppt As outlook.AppointmentItem
Set olAppt = olApp.CreateItem(olAppointmentItem)

(... fill the appointment ... )

olAppt.Send
olAppt.Save

mapiSession.Logoff

Set mapiSession = Nothing
[ END OF CODE]

Ads