Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Other Office > Visual Studio Tools for Office
|
Visual Studio Tools for Office Be 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 Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 26th, 2009, 03:12 AM
Registered User
 
Join Date: Sep 2009
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation How can i add action on all active inspector

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


AddHandler mailItem.CustomAction, AddressOf MailItem_CustomAction

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

End Class

---------------------------------------------------------------------
 
Old October 28th, 2009, 11:21 AM
Registered User
 
Join Date: Oct 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

HI

Just by using for or foreach loop

and inside the loop

Dim action As Outlook.Action = mailItem.Actions.Add()
action.Name = "vsto action 1"
... other properties
...

This will work ...

cheers!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Add user to group - Active Directory anurag_ur ASP.NET 2.0 Professional 0 January 17th, 2006 02:54 AM
Add user to group - Active Directory anurag_ur ASP.NET 1.0 and 1.1 Professional 0 January 16th, 2006 09:25 AM
Add User to group - Active Directory anurag_ur .NET Framework 1.x 0 January 16th, 2006 09:15 AM
Add User to group - Active Directory anurag_ur C# 0 January 16th, 2006 09:13 AM
Add User to group - Active Directory anurag_ur ASP.NET 1.0 and 1.1 Basics 0 January 16th, 2006 09:13 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.