473,785 Members | 2,714 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

getting at outlook inboxes programmaticall y

I am trying to get at different users inboxes programmaticall y (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.Applica tion oApp = new Outlook.Applica tion();

//Get MAPI namespace
Outlook.NameSpa ce oNS = oApp.GetNamespa ce("mapi");

oNS.Logon("user ", "password", false, true);

//Get Messages collection of Inbox
Outlook.MAPIFol der oInbox =
oNS.GetDefaultF older(Outlook.O lDefaultFolders .olFolderInbox) ;

Outlook.Items oItems = oInbox.Items;

int intTotalNumberO fItemsInInbox = oItems.Count;

//Get unread e-mail messages
oItems = oItems.Restrict ("[Unread] = true");
int intTotalUnread = oItems.Count;


*** Sent via Developersdex http://www.developersdex.com ***
Feb 19 '07 #1
13 1717
On Feb 19, 10:58 am, Mike P <mike.p...@gmai l.comwrote:
I am trying to get at different users inboxes programmaticall y (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.Applica tion oApp = new Outlook.Applica tion();

//Get MAPI namespace
Outlook.NameSpa ce oNS = oApp.GetNamespa ce("mapi");

oNS.Logon("user ", "password", false, true);

//Get Messages collection of Inbox
Outlook.MAPIFol der oInbox =
oNS.GetDefaultF older(Outlook.O lDefaultFolders .olFolderInbox) ;

Outlook.Items oItems = oInbox.Items;

int intTotalNumberO fItemsInInbox = oItems.Count;

//Get unread e-mail messages
oItems = oItems.Restrict ("[Unread] = true");
int intTotalUnread = oItems.Count;

*** Sent via Developersdexht tp://www.developersd ex.com***

<identity impersonate="tr ue"/>

?

Feb 19 '07 #2
Identity impersonate could be used to hard code a single user's login
details, but I want to be able to have a situation where the user of the
page can select a user from a dropdown and be able to access their
emails.

*** Sent via Developersdex http://www.developersdex.com ***
Feb 19 '07 #3
"Mike P" <mi*******@gmai l.comwrote in message
news:eT******** ******@TK2MSFTN GP04.phx.gbl...
//Create Outlook application
Outlook.Applica tion oApp = new Outlook.Applica tion();
http://support.microsoft.com/default...US;q257757#kb2

Read the "MORE INFORMATION" section, specifically the paragraph in bold...

There's a very strong possibility that this won't work at all in a
production environment...
Feb 19 '07 #4
On Feb 19, 2:42 pm, Mike P <mike.p...@gmai l.comwrote:
Identity impersonate could be used to hard code a single user's login
details, but I want to be able to have a situation where the user of the
page can select a user from a dropdown and be able to access their
emails.

*** Sent via Developersdexht tp://www.developersd ex.com***
Well, I've quickly checked the MSDN and now I'm not sure if you follow
the right way.

As I understand now, Outlook.Applica tion is for automation with local
Outlook and I'm affraid with the current Outlook session.

For tasks like you wanted to do there is another way using Microsoft
Collaboration Data Objects (CDO) for Exchange 2000 Library.

Please check the following MSDN article
http://support.microsoft.com/?kbid=310206

you will need to know path to your Exchange, username and password

Feb 19 '07 #5
"Alexey Smirnov" <al************ @gmail.comwrote in message
news:11******** **************@ t69g2000cwt.goo glegroups.com.. .
Well, I've quickly checked the MSDN and now I'm not sure if you follow
the right way.
The OP most definitely doesn't...
As I understand now, Outlook.Applica tion is for automation with local
Outlook and I'm affraid with the current Outlook session.
Absolutely correct - simply not designed for server-side automation at
all...
For tasks like you wanted to do there is another way using Microsoft
Collaboration Data Objects (CDO) for Exchange 2000 Library.
And for later versions of Exchange too...
Feb 19 '07 #6
If I can't do what I am trying to do using the Outlook object model, do
you have any useful links with regard to doing this using Microsoft
Collaboration Data Objects (CDO) for Exchange 2000 Library, which I am
totally unfamiliar with.

*** Sent via Developersdex http://www.developersdex.com ***
Feb 19 '07 #7
"Mike P" <mi*******@gmai l.comwrote in message
news:OH******** *****@TK2MSFTNG P04.phx.gbl...
If I can't do what I am trying to do using the Outlook object model, do
you have any useful links with regard to doing this using Microsoft
Collaboration Data Objects (CDO) for Exchange 2000 Library, which I am
totally unfamiliar with.
This should get you started:
http://msdn2.microsoft.com/en-us/library/ms986138.aspx

Although it relates to Exchange 2003, it will be very similar for Exchange
2000...
Feb 20 '07 #8
Mark,

I've just found out the version being used is 5.5...any links for this
version, or is it likely to be similar to 2003?
Thanks,

Mike
*** Sent via Developersdex http://www.developersdex.com ***
Feb 20 '07 #9
"Mike P" <mi*******@gmai l.comwrote in message
news:ej******** *****@TK2MSFTNG P06.phx.gbl...
I've just found out the version being used is 5.5...
Wow! That's fairly old now...
any links for this version,
I guess the place to start would be here:
http://msdn.microsoft.com/library/de...vr_e55_sdk.asp
However, it's not exactly brimming with code samples...
or is it likely to be similar to 2003?
Not at all - the problem that you're going to come up against is that
access to Exchange 5.5 mailboxes is through CDO 1.21, and that isn't
supported in .NET, at least, not natively... I recall doing some VB6
programming against 5.5 about six years ago, but unfortunately can't locate
the code any more - I'm not even sure I still have it, not that it would
have helped you a great deal...

The link below suggests using COM InterOp - that *may* work...
http://www.thescripts.com/forum/thread300002.html
Feb 20 '07 #10

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

Similar topics

14
6962
by: John | last post by:
Hi Is there a way to e-mail using outlook2002 from within vb.net without getting the nasty "An application is trying to access you outlook..." message? Thanks Regards
1
4341
by: Roger | last post by:
I currently have an application that can monitor the Inbox of one mailbox running on a client using Outlook 2003. This is a standalone application that needs Outlook to be running in order to see all mail coming into the e-mail box. This is using Interop.Outlook Example of code... Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
2
14413
by: Siv | last post by:
Hi, I have written an application which is used by sales staff when discussing products with their customers over the phone. It is a database application that holds detailed information about their products including pictures to assist the sales staff describe features to the customer. The next step in development of the app is to have a button when in a particular product screen that the seller can press which sends the customer an...
2
2812
by: hsuntn | last post by:
I am grabbing Outlook MailItems using the Items property on my Outlook inbox. When I iterate through them, I notice that they are not ordered in ReceivedTime or CreationTime order. For example, Items.ReceivedTime is April 2005 Items.ReceivedTime is May 2005 Items.ReceivedTime is October 2005 Items.ReceivedTime is June 2005 I did some experiments and the following seems to explain how
4
15073
by: Brian Hampson | last post by:
I recently upgraded to Outlook 2007 B2TR and have found that I can no longer code against MAPI.DLL It's gone :( Using C#, I used to get the MAPI session, and from that I could change the out of office. No longer. Does anyone know how to do this using the new Microsoft.Office.Core and Microsoft.Office.Outlook DLL's that are supposed to be the new replacements? Here's what I had that worked until Outlook 2007 came around:
1
3224
by: =?Utf-8?B?cm9i?= | last post by:
C#.Net Outlook 2003 automation (programmatically) with Office.Interop.Outlook Problem: I have my outlook 2003 configured with multiple mailbox on my local machine. I want to specify the mailbox and server (Exchange server mail box) to connect and then save the mailitems(from Inbox or any other folder) based on a filter to a*.msg file. I want to achieve this using only one Interop dll if this is possible. Tried so far:
1
2872
by: allbelonging | last post by:
C#.Net Outlook 2003 automation (programmatically) with Office.Interop.Outlook Problem: I have my outlook 2003 configured with multiple mailbox on my local machine. I want to specify the mailbox and server (Exchange server mail box) to connect and then save the mailitems(from Inbox or any other folder) based on a filter to a*.msg file. I want to achieve this using only one Interop dll if this is possible. Tried so far:
5
10621
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
4
5158
by: musicloverlch | last post by:
Hi all, I have a database being used by 30 people and is split between the backend and frontend. The database has the ability to send e-mails through Outlook and I have even put Redemption on people's PCs as to not get all the Outlook security prompts. Here's the problem: Half are using Outlook 2003, the other half is using Outlook 2007, and 1 is using Outlook XP. I am using Outlook 2007, so my reference is set to use Microsoft...
0
9480
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
10319
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
10147
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...
1
7496
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
6737
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();...
0
5380
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...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4046
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
3
2877
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.