Using VB6 to display the Category and Folder of an email in Outlook 2007
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 NextEnd Sub
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
Qlemo
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.
jana
ASKER
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?
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
- 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