PDA

View Full Version : Solved: extract body of the message



v_gyku
09-30-2005, 12:11 AM
I have a listview on a form, in that listview i am displaying to, subject and sentdate from outlook inbox.
When i select any of the item from listbox i get the subject for the selected item by this code :



objform.ListView1.SelectedItem.SubItems(1)


But i also want body of the selected message. Note that i am not taking body in the listview. If i take body in listview it will be quite easy to get it(same as above code.) But, I dont want to show body in listview. Or is there any way that i can hide body column from listview.............. Or without adding it to listview can i get ody of the selected message?

This code is for inbox


Dim oinFolder As Object
Set oinFolder = oNameSpace.GetDefaultFolder(outlook.OlDefaultFolders.olFolderInbox)


THis is the code for adding to listview


For Each Inboxmail In oinFolder.Items

Dim j As Integer
j = 1

With ListView1.ListItems
.Add j, , Inboxmail.To
End With

With ListView1
.ListItems(j).SubItems(1) = Inboxmail.subject
End With

With ListView1
.ListItems(j).SubItems(2) = Inboxmail.SentOn
End With

'With ListView1
' .ListItems(j).SubItems(3) = Inboxmail.body
' End With
j = j + 1

Next

chocobochick
09-30-2005, 06:55 AM
I'm unfamiliar with usign a listview control, but I imagine you could use the same tricks as with a listbox. If you can find a way to set the column widths in the display, you can include the message body as a 0"-width column.

If that doesn't work, it appears each ListItem in a ListView has a Tag property (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcmn98/html/vbprotagpropertyactivexcontrols.asp). You can probably set the message body string to this property.