Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Using VB6 to display the Category and Folder of an email in Outlook 2007

Posted on 2011-03-05
7
Medium Priority
?
630 Views
Last Modified: 2012-05-11
We have a code that displays all the emails in Outlook 2007.

We want to also display the folder where its saved and also the category that is assign,

How can we incorporate this in our app?

(Included is part of the code, its in VB6)
Sub ProcessStore(olkFld As Object)
    Const olMailItem = 0
    Const olMail = 43
    Dim olkItm As Object, olkSub As Object, olkAtt As Object
    If olkFld.DefaultItemType = olMailItem Then
        For Each olkItm In olkFld.Items
            If olkItm.Class = olMail Then
                strBuffer = strBuffer & x & " - " & sp _
                          & olkItm.SentOn & sp & olkItm.ReceivedTime & sp & olkItm.SenderName & sp _
                          & olkItm.Subject & sp & olkItm.to & sp & olkItm.Body & vbCrLf
               'Display and export
                List.AddItem strBuffer
                Print #2, strBuffer
                strBuffer = ""
            End If
        Next
    End If
    
    For Each olkSub In olkFld.Folders
        ProcessStore olkSub
    Next
End Sub

Open in new window

0
Comment
Question by:rayluvs
[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
7 Comments
 
LVL 2

Expert Comment

by:active_agent
ID: 35046393
Just to confirm, you are looking to display the folder name and categories associated with the mail item.

- Folder Name : You are already passing the Folder object to ProcessStore, i believe there is Name property to that object.
- Category : Have you tried Categories property of mail item you were displaying.

Let me know how it goes.

Thanks
0
 
LVL 71

Expert Comment

by:Qlemo
ID: 35046420
That is correct. If you want to display the complete path of the folder, you can use .FolderPath.
MailItem.Categories consists of a concatenated String of categories - so there can be more than one categorie in it.
0
 

Author Comment

by:rayluvs
ID: 35046562
Yes , I am looking to display the folder name and categories associated with the mail item.

I tried ".FolderPath' and it gave me

                      Run-time error: '438'  
                      Object doesn't support this property or method

How do I use MailItem.Categories to display the string or categories?
0
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
LVL 59

Accepted Solution

by:
Chris Bottomley earned 1000 total points
ID: 35046632
The parent is the folder therefore:
olkItm.parent.folderpath

and for the category string
olkitm.categories

Chris
0
 
LVL 71

Assisted Solution

by:Qlemo
Qlemo earned 1000 total points
ID: 35046641
I assume that is not your code? Because we thought you have some experience already, so we haven't been much detailled in our answers.

Chris is correct. You can access the folder path either by
   olkItm.Parent.FolderPath
or, since we also have the folder itself ready,
   olkFld.FolderPath
0
 

Author Comment

by:rayluvs
ID: 35046739
Thanx, worked perfectly!
0
 

Author Closing Comment

by:rayluvs
ID: 35046744
thanx
0

Featured Post

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
In this article I discuss my selections of the Top Four free Outlook OST File Viewers available. Open, view and read even damaged OST files by using these tools. They all provide a clear preview of all data such as emails, notes, tasks, calendars, e…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

722 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