oliv-
Senior Member
- Outlook version
- Outlook 2010 32 bit
- Email Account
- Exchange Server
Hi,
I want to extend a code from Mickael BAUER.
From an Mailitem i want to display an explorer with this Email selected
BUT IF THE FOLDER IS mark "Show as conversation", the code is wrong
how select an Email in cconversation mode ?
how turn off/on conversation mode for just this folder ?
I want to extend a code from Mickael BAUER.
From an Mailitem i want to display an explorer with this Email selected
BUT IF THE FOLDER IS mark "Show as conversation", the code is wrong
how select an Email in cconversation mode ?
how turn off/on conversation mode for just this folder ?
Code:
Public Sub GetItemsFolderPath()
Dim obj As Object
Dim F As Outlook.MAPIFolder
Dim NewExpl As Explorer
Dim Msg$
Set obj = Application.ActiveWindow
If TypeOf obj Is Outlook.Inspector Then
Set obj = obj.CurrentItem
Else
Set obj = obj.Selection(1)
End If
Set F = obj.Parent
Msg = "The path is: " & F.FolderPath & vbCrLf
Msg = Msg & "Switch to the folder?"
If MsgBox(Msg, vbYesNo) = vbYes Then
Set NewExpl = Application.Explorers.add(F, olFolderDisplayFolderOnly)
NewExpl.Activate
Set acticselection = NewExpl.Selection.item(1)
On Error GoTo Errohandler
NewExpl.ClearSelection
NewExpl.AddToSelection obj
NewExpl.RemoveFromSelection acticselection
NewExpl.Display
NewExpl.WindowState = olMaximized
End If
Exit Sub
Errohandler:
MsgBox Err & vbCr & Err.Description
' Dim colCB, objCBB
' Set colCB = NewExpl.CommandBars
'
' If Not NewExpl Is Nothing Then
' If NewExpl.CommandBars.GetPressedMso("ShowInConversations") Then
' NewExpl.CommandBars.ExecuteMso ("ShowInConversations")
' End If
'
' End If
' 'NewExpl.CurrentView
' NewExpl.ClearSelection
Resume
End Sub
Sub DemoConversationTable()
Dim oConv As Outlook.Conversation
Dim oTable As Outlook.table
Dim oRow As Outlook.Row
Dim oMail As Outlook.MailItem
Dim oItem As Outlook.MailItem
Const PR_STORE_ENTRYID As String = _
"http://schemas.microsoft.com/mapi/proptag/0x0FFB0102"
On Error Resume Next
' Obtain the current item for the active inspector.
Set oMail = Application.ActiveInspector.CurrentItem
If Not (oMail Is Nothing) Then
' Obtain the Conversation object.
Set oConv = oMail.GetConversation
If Not (oConv Is Nothing) Then
Set oTable = oConv.GetTable
oTable.Columns.add (PR_STORE_ENTRYID)
Do Until oTable.EndOfTable
Set oRow = oTable.GetNextRow
' Use EntryID and StoreID to open the item.
Set oItem = Application.Session.GetItemFromID( _
oRow("EntryID"), _
oRow.BinaryToString(PR_STORE_ENTRYID))
Debug.Print oItem.subject, _
"Attachments.Count=" & oItem.Attachments.Count
Loop
End If
End If
End Sub