473,597 Members | 2,157 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Way to Specify Profile for Outlook ?

I have the following code in my Access application:

Dim OutApp As Outlook.Applica tion
Dim OutMail As Outlook.MailIte m

Set OutApp = CreateObject("O utlook.Applicat ion")
Set OutMail = OutApp.CreateIt em(olMailItem)

Then later in the code, I use 'With OutMail' to send emails.

Is there a way within the VB code to specifiy the Outlook profile to use ?
(My app needs to run unattended and I can't have Outlook prompting
for the profile to use.)

Thanks,
Tom

Nov 21 '05 #1
1 1717
Tom,
This is a .NET newsgroup, not Access nor VB6.

To answer your question, the Namespace.Logon method allows you to specify
the profile to use:

Something like (untested):

Dim OutApp As Outlook.Applica tion
Dim OutNS As Outlook.NameSpa ce
Dim OutMail As Outlook.MailIte m

Set OutApp = CreateObject("O utlook.Applicat ion")

Set OutNS = OutApp.GetNames pace("MAPI")
OutNS.Logon "My Profile"

Set OutMail = OutApp.CreateIt em(olMailItem)

NameSpace.Logon has some optional parameters to specify password, UI, & new
Session...

Hope this helps
Jay

"Tom Glasser" <To********@dis cussions.micros oft.com> wrote in message
news:41******** *************** ***********@mic rosoft.com...
I have the following code in my Access application:

Dim OutApp As Outlook.Applica tion
Dim OutMail As Outlook.MailIte m

Set OutApp = CreateObject("O utlook.Applicat ion")
Set OutMail = OutApp.CreateIt em(olMailItem)

Then later in the code, I use 'With OutMail' to send emails.

Is there a way within the VB code to specifiy the Outlook profile to use ?
(My app needs to run unattended and I can't have Outlook prompting
for the profile to use.)

Thanks,
Tom

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4352
by: Victor Hadianto | last post by:
Hello, Not sure if this is the right NG to ask but I'll fire away. How do I programatically create an Outlook user profile using .Net? I want to import a PST into the newly created profile and extract all the emails and save it to disk. I have done the rest of the program and only missing the creation of the new profile. I don't want to mess around with the current default profile in Outlook. Regards,
3
1807
by: FE | last post by:
Guys, I need to create a program (VB) to dump the outlook profile of a user. By dump I mean a report such as : User : Mr A * Folder 1 : exchange mailbox * Folder 2 : c:\data\pst1.pst * Folder 2 : c:\data\pst2.pst
1
5716
by: FE | last post by:
> Guys, > > I need to create a program (VB) to dump the outlook profile of a user. > > By dump I mean a report such as : > > User : Mr A > * Folder 1 : exchange mailbox > * Folder 2 : c:\data\pst1.pst > * Folder 2 : c:\data\pst2.pst
2
1969
by: | last post by:
Hi all, How can I get a reference to my custom profile provider in my .aspx page? I have looked at httpcontext.current.profile. But from there where do I go? Ideally I would like to be able to get default profile provider without having to know the "name" configured in web.config. TIA!
6
2215
by: Shimon Sim | last post by:
Hi I am working on application that need to hold custom user information - Last and first name, email, some other domain related information. I used to create Base class for all my pages. The base class would have CurrentUser property that would hold customer class in session and that was fine for all my situations. Now ASP.NET 2.0 came and we have Profile property for pages that could be extended with configuration to have custom...
3
8685
by: Paul | last post by:
Hello, I am trying to set up a program that will email me when a process has been completed by a user. The user uses a program that moves some files, after these files are moved I want the program to also send an email that the process has been completed. The PC's are set up to use outlook profiles. When a user logs into our 2000 domain server through that machine, and they open outlook they are presented with a box to chose the...
1
1755
by: jazeelkm | last post by:
Hi all, I am developing an windows application using C#. In that application I have to extract all the email ids stored in the contact folder of the outlook... Now I can extract the details using the following code... It works fine if there s only a one profile.. If there s more than one profile it will extract details from the folders under default profile... So my problem is How can I switch between the profiles.. ie, if there are two...
1
4383
by: vibhavleo | last post by:
I am using the Microsoft Office 11.0 Object library to connect to outlook. My code is as follows: _ApplicationPtr application("Outlook.Application"); CComPtr<_NameSpace> ns; CComPtr<_NameSpace> session; hr = application->GetNamespace(CComBSTR("MAPI"),&session.p); if(hr != S_OK) return hr; hr = application->get_Session(&session.p); if(hr != S_OK) return hr; hr =...
0
908
by: =?Utf-8?B?amFuZXR0ZQ==?= | last post by:
I recently had an error message "can't load the locally stored profile" and after reading this website created a new user account and copied the files from the old username to the new username. My email messages were not transferred over to the new username and the import procedures outlined in miscrosoft kb 313055 relates to outlook express but I use microsoft outlook. Can anyone assist me with import procedures for microsoft outlook. ...
0
7885
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8271
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8380
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6686
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5847
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5426
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2399
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1493
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1231
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.