Visual Studio Tools for OfficeBe sure to specify which version you are working with.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Visual Studio Tools for Office section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
the below action working just on the first mail in inbox how can i customized it to work on all mail item
-----------------------------------------------------------------------------
Public Class ThisAddIn
Private WithEvents mailItem As Outlook.MailItem
Private WithEvents items As Outlook.Items
Private Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles Me.Startup
Dim ns As Outlook.NameSpace = Application.Session
Dim inbox As Outlook.MAPIFolder = ns.GetDefaultFolder( _
Outlook.OlDefaultFolders.olFolderInbox)
For Each o As Object In inbox.Items
If TypeOf o Is Outlook.MailItem Then
mailItem = o
Else
Exit For
End If
Next
Dim action As Outlook.Action = mailItem.Actions.Add()
action.Name = "My custom action"
action.ShowOn = Outlook.OlActionShowOn.olMenuAndToolbar
action.ReplyStyle = Outlook.OlActionReplyStyle.olLinkOriginalItem
'End If
End Sub
Private Sub MailItem_CustomAction(ByVal action As Object, _
ByVal response As Object, ByRef cancel As Boolean)
MessageBox.Show("Add mail")
mailItem.SaveAs("C:\Test.msg")
End Sub