Solved

outlook access added mail box under personal folder

Posted on 2013-12-07
2
283 Views
Last Modified: 2013-12-22
have the below code that will roll through the inbox but need to access the added folder mail.abc.com
the code works for the inbox but need to cycle through the code in the mail.abc.com see image.
not sure of the syntax to change to access this folder
any help would be appreciated


Sub GetFromInbox()

    Dim olApp As Outlook.Application
    Dim olNs As NameSpace
    Dim Fldr As MAPIFolder
    Dim olMail As Variant
    Dim i As Integer

    Set olApp = New Outlook.Application
    Set olNs = olApp.GetNamespace("MAPI")
    Set Fldr = olNs.GetDefaultFolder(olFolderInbox)
 
    For Each olMail In Fldr.Items

       MsgBox olMail.Body
   
    Next olMail

    Set Fldr = Nothing
    Set olNs = Nothing
    Set olApp = Nothing

End Sub

pic
0
Comment
Question by:sydneyguy
2 Comments
 
LVL 20

Accepted Solution

by:
ltlbearand3 earned 500 total points
ID: 39703830
Not completely sure what folder you need to view in your email folders.  It sounds like you have an additional folder in mail.abc.com you want to access.  You could do that with some code like this:

    Dim Fldr2 As MAPIFolder
	Set Fldr2 = Outlook.Session.Folders("mail.abc.com").Folders("OtherSubFolder")

Open in new window


If you are wanting the inbox in the personal folders then you could do something like this:
    Dim Fldr2 As MAPIFolder
	Set Fldr2 = Outlook.Session.Folders("Personal Folders").Folders("OtherSubFolder")

Open in new window


There are many other ways to approach this, but I would need some clearer details to be able to help more.

-Bear
0
 

Author Closing Comment

by:sydneyguy
ID: 39735492
thanks for your help
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Set OWA language and time zone in Exchange for individuals, all users or per database.
Use email signature images to promote corporate certifications and industry awards.
Viewers will learn the different options available in the Backstage view in Excel 2013.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

744 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now