473,668 Members | 2,594 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

switching outlook profile

4 New Member
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 profiles 'Profile1' and 'Profile2' .. I want give the user to select the profile they want .. how can I achieve that.?

Here s My code(clicking the button will extract the email addresses from contact folder and will add that into the listbox)

private void btnExtract_Clic k(object sender, EventArgs e)
{
Outlook.Applica tion app= new Microsoft.Offic e.Interop.Outlo ok.Application( );
Outlook.NameSpa ce ns = app.GetNamespac e("MAPI");

object _missing = System.Reflecti on.Missing.Valu e;

Outlook.MAPIFol der ctc = ns.GetDefaultFo lder(Outlook.Ol DefaultFolders. olFolderContact s);

foreach (Outlook.Contac tItem citem in ctc.Items)
{
listIds.Items.A dd(citem.Email1 Address);
}
}


Thanking you in advance
Jaz
Jun 29 '07 #1
1 1757
kenobewan
4,871 Recognized Expert Specialist
Profile object in the Asp.net 2.0 is quite similar to the Session variables in the Asp.net 1.1 with one exception that profile stays consistent and is not lost when the user leaves the website. If you remember Session variables is lost if you leave the particular website and than if you visit the website again a new session had to be created.
Jul 1 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1719
by: srinivas | last post by:
Hi, i'm trying to retreive the appointments from different profiles of outlook. My outlook has 3 profiles created.('Sample1','Sample2','Sample3') my form contains 3 buttons.each one for each profile. so when user clicks on a button my code has to show the appointments for that particular profile that was given there. i wrote a small procedure for that here's the code: ----------------------------
9
6726
by: Srinivas | last post by:
hi all how to access the outlook user profiles through VB.net any help.... thanks in advanc Srinivas
3
8686
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
1719
by: Tom Glasser | last post by:
I have the following code in my Access application: Dim OutApp As Outlook.Application Dim OutMail As Outlook.MailItem Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(olMailItem) Then later in the code, I use 'With OutMail' to send emails.
6
21306
by: Manuel | last post by:
Hi, Using the PIA "Microsoft Outlook 11 Object Library". I've noticed that the Logon method of the NameSpace Object is simply ignored. My Outlook 2003 is full updated. For example if I write: Dim oApp As New Outlook.Application
5
10600
by: Mike P | last post by:
I am trying to get at different users inboxes programmatically (see code below). It works fine, except for the fact that the logon line seems to always logon to my local account rather than logging on to other accounts on the network. Anybody know how to logon to other people's accounts using this method? //Create Outlook application Outlook.Application oApp = new Outlook.Application(); //Get MAPI namespace
0
1624
by: jazeelkm | last post by:
Hi , I am developing a windows application using C#. In that I want to display all the outlook profiles in a listbox and on selecting one, The folder structure should be displayed on a treeview control. I can display all the profiles in the listbox and on its changedindex event I am calling the function to load all outlook folders(and add that to the treeview). When i run the application first time it is working properly , but when i...
1
4387
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 =...
1
2100
by: mary mathews | last post by:
Hi, I'm getting an exception while tried to retrive an outlook contact using asp.net in a console application. The exception is as follows: An unhandled exception of type 'System.NullReferenceException' occurred in ConsoleApplication1.exe,Additional information: Object reference not set to an instance of an object .. Can anybody help me pls.... my code is like this..
0
8459
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8889
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
8790
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
8652
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7391
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
6206
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
4202
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2017
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1779
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.