Solved

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

Posted on 2011-03-05
7
627 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 70

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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
LVL 59

Accepted Solution

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

and for the category string
olkitm.categories

Chris
0
 
LVL 70

Assisted Solution

by:Qlemo
Qlemo earned 250 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
outlook 365 3 62
Exchange 2010 Global Calendar Permissions 2 55
How to consolidate .ods files in one sheet 30 43
2 Global Vars, 1 List Box 4 34
This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
How to resolve IMCEAEX NDRs in Exchange or Exchange Online related to invalid X500 addresses.
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: …
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…

710 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