Sending appointment not using default profile

  • Thread starter Thread starter David
  • Start date Start date
D

David

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]
 
Under the Outlook object model, only one mail profile can be running at a time. If Outlook is already running, you can't perform a logon to another profile. For your scenario, you would need to use CDO 1.21 or, to avoid security prompts, Redemption (http://www.dimastr.com/redemption/) instead of Outlook objects.
 
Hi sue, thanks for the help.

What's the difference with Outlook object and CDO1.21 object?

Do you have any example of CDO1.21 session logon ?

I'll try to find some article on CDO1.21, i'll be back later

Thanks again!!

Sue Mosher said:
Under the Outlook object model, only one mail profile can be running at a time. If Outlook is already running, you can't perform a logon to another profile. For your scenario, you would need to use CDO 1.21 or, to avoid security prompts, Redemption (http://www.dimastr.com/redemption/) instead of Outlook objects.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


David said:
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]
 
CDO is a lower-level API. You can get lots of information on it and the Session.Logon method at http://www.cdolive.com

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


David said:
Hi sue, thanks for the help.

What's the difference with Outlook object and CDO1.21 object?

Do you have any example of CDO1.21 session logon ?

I'll try to find some article on CDO1.21, i'll be back later

Thanks again!!

Sue Mosher said:
Under the Outlook object model, only one mail profile can be running at a time. If Outlook is already running, you can't perform a logon to another profile. For your scenario, you would need to use CDO 1.21 or, to avoid security prompts, Redemption (http://www.dimastr.com/redemption/) instead of Outlook objects.

David said:
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]
 
Thanks a lot Sue.

It works perfectly.

Using CDO, I'm able to send/delete any appointment in Outlook using my 2nd
profile.

You're the best ;)

Best regards

David

Sue Mosher said:
CDO is a lower-level API. You can get lots of information on it and the Session.Logon method at http://www.cdolive.com

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


David said:
Hi sue, thanks for the help.

What's the difference with Outlook object and CDO1.21 object?

Do you have any example of CDO1.21 session logon ?

I'll try to find some article on CDO1.21, i'll be back later

Thanks again!!

Sue Mosher said:
Under the Outlook object model, only one mail profile can be running at a time. If Outlook is already running, you can't perform a logon to another profile. For your scenario, you would need to use CDO 1.21 or, to avoid security prompts, Redemption (http://www.dimastr.com/redemption/) instead of Outlook objects.

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]
 
Back
Top