Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2010-09-09
3
Medium Priority
?
481 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 76

Accepted Solution

by:
David Lee earned 1000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Gain an elementary understanding of Blockchain technology.
By default Outlook 2016 displays only one time zone in the Calendar. The following article explains how to display two time zones in one calendar view.
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

618 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