Solved

How do I access the Inbox of a second Outlook account in VB .NET?

Posted on 2010-09-09
3
466 Views
Last Modified: 2012-05-10
I've got a small application monitoring the Inbox of my primary Outlook account which works a treat. However, I have a second account and I want the same application to check for unread items in that account's inbox.

My current code includes the following for the default account:

                oNS = PharmarOutlook.GetNamespace("MAPI")

                oInbox = _
                oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)
                oItems = oInbox.Items
                oItems = oItems.Restrict("[Unread]=true")

Is it just a question of tweaking this to access the second account?


Many thanks for any assistance given.
0
Comment
Question by:milesryoung
  • 2
3 Comments
 
LVL 76

Accepted Solution

by:
David Lee earned 250 total points
ID: 33644554
Hi, milesryoung.

Use the same code but instead of GetDefaultFolder use the GetSharedDefaultFolder method.
0
 

Author Closing Comment

by:milesryoung
ID: 33646868
Thanks. This involves having to resolve the recipient name as well but did the trick if you know the names of the accounts.

I now have to ask a new question about how to iterate through the accounts.

myRecipient = oNS.CreateRecipient("Person Name")
myRecipient.Resolve()
0
 
LVL 76

Expert Comment

by:David Lee
ID: 33646892
You're welcome.  
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article will shed light on the latest trends when it comes to your resume building needs. For far too long, the traditional CV format has monopolized the recruitment market.
MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question