A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Sending appointment not using default profile



 
 
Thread Tools Search this Thread Display Modes
  #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]

  #2  
Old March 11th 08, 03:31 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Sending appointment not using default profile

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" wrote in message ...
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]

  #3  
Old March 11th 08, 05:06 PM posted to microsoft.public.outlook.program_vba
David
external usenet poster
 
Posts: 196
Default Sending appointment not using default profile

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 [MVP-Outlook]" wrote:

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" wrote in message ...
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]


  #4  
Old March 11th 08, 05:30 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Sending appointment not using default profile

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" wrote in message ...
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 [MVP-Outlook]" wrote:

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" wrote in message ...
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]


  #5  
Old March 11th 08, 08:10 PM posted to microsoft.public.outlook.program_vba
David
external usenet poster
 
Posts: 196
Default Sending appointment not using default profile

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 [MVP-Outlook]" wrote:

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" wrote in message ...
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 [MVP-Outlook]" wrote:

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" wrote in message ...
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]



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to make old .pst calendar the default in a new profile? Pinky01 Outlook - Calandaring 6 March 13th 08 09:23 PM
Get default outlook profile EMailID Sanjay_S via OfficeKB.com Outlook and VBA 1 October 16th 06 08:51 PM
default outlook profile John M Outlook - General Queries 3 August 11th 06 04:56 PM
Creating a new MST for Office 2K3 and need help with the default profile variable [email protected] Outlook - Installation 0 May 5th 06 06:12 PM
Default Outlook Profile NoSurprises Outlook - Installation 0 January 20th 06 06:04 PM


All times are GMT +1. The time now is 11:35 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.