 |
BOOK: Professional Outlook 2007 Programming ISBN: 978-0-470-04994-5
 | This is the forum to discuss the Wrox book Professional Outlook 2007 Programming by Ken Slovak; ISBN: 9780470049945 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Professional Outlook 2007 Programming ISBN: 978-0-470-04994-5 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
|
|
|

December 17th, 2007, 08:29 PM
|
Authorized User
|
|
Join Date: Aug 2004
Posts: 95
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Form does not open when commandbar button clicked
Hello,
I've finally been able to put together something that looks like it's functioning properly, but it's not :(
What I have below, creates the Menu Bar and the CommandBar Button, but the form does not open when the commandbar button is clicked. What am I doing wrong? Please help.
BTW I'm using Visual Studio 2005 with VSTO and the add-in is intended for Outlook 2003.
Imports Office = Microsoft.Office.Core
Imports System.Xml
Imports System.IO
Imports System.Configuration
Imports System.Collections
Imports System.Net
Public Class ThisApplication
Private WithEvents _Explorers As Outlook.Explorers
Private WithEvents _Explorer As Outlook.Explorer
Private _mapiFormsFolder1 As Outlook.MAPIFolder
Private _fpItems As Outlook.Items
Private _fpItem As Object
Private _helpMenuIndex As Object
Private _topMenu As Office.CommandBarPopup
Private WithEvents _OpenForm As Office.CommandBarButton
Private _menuBar As Office.CommandBar
Private Const _MENU_BEFORE As String = "Help"
Private Sub ThisApplication_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup
_Explorer = Me.ActiveExplorer()
_mapiFormsFolder1 = Me.ActiveExplorer().Session.GetDefaultFolder(Outlo ok.OlDefaultFolders.olPublicFoldersAllPublicFolder s).Folders("Our Forms")
BuildTopMenu()
End Sub
Private Sub ThisApplication_Shutdown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shutdown
_
End Sub
Private Sub BuildTopMenu()
_menuBar = Me.ActiveExplorer().CommandBars.ActiveMenuBar
_helpMenuIndex = _menuBar.Controls(_MENU_BEFORE).Index
_topMenu = CType(_menuBar.Controls.Add(Office.MsoControlType. msoControlPopup, , , _helpMenuIndex, True), Office.CommandBarPopup)
_topMenu.Caption = "Our Forms"
_topMenu.Visible = True
_OpenForm = CType(_topMenu.Controls.Add(Office.MsoControlType. msoControlButton, , , , True), Office.CommandBarButton)
_OpenForm.Caption = "New Video Request Form"
_OpenForm.Visible = True
_OpenForm.Enabled = True
End Sub
Private Sub Menu_Click(ByVal Ctrl As Microsoft.Office.Core.CommandBarButton, ByRef CancelDefault As Boolean) Handles _OpenForm.Click
Try
_fpItems = _mapiFormsFolder1.Items
_fpItem = _fpItems.Add("IPM.Note.New Video Request Form")
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
End Class
Thanks for your help in advance!!!
*******(*)*******
__________________
*******(*)*******
|

December 18th, 2007, 12:30 PM
|
Wrox Author
|
|
Join Date: Sep 2007
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Is that custom form published? Any custom form in Outlook 2007 and most versions of Outlook 2003 must be published before you can use them.
Also, you are just adding a custom form to a folder's Items collection. If you want to see the item display it:
_fpItem.Display()
Ken Slovak
|

December 18th, 2007, 12:54 PM
|
Authorized User
|
|
Join Date: Aug 2004
Posts: 95
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
WOW!!! Thank you so much! That was it! I had that line of code in there, but I don't know what happened to it.....
Would you be able to give me some links to learn how to do an uninstall of an add-in? Also, if after this is installed on users' systems, if I need to add more forms to the pop up menu, would I only have to recompile and reinstall? What is the process?
Thanks again!!!!:D
*******(*)*******
|

December 18th, 2007, 03:33 PM
|
Wrox Author
|
|
Join Date: Sep 2007
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
To uninstall any addin that was installed using an MSI or setup.exe generated by the Visual Studio installer or InstallShield or Wise, etc. you go to the Add/Remove Programs (Programs) application in the Control Panel and select to remove the addin. That should clean everything up other than any log files, etc. that you wrote out. Those have to be removed using code, usually a custom action in the installer.
Adding things depends on how you set them up. You certainly can change the code, increment the version and make a new compilation and installer.
I usually write out an INI file or something like that, or even an XML file that can be downloaded from the Web or a network UNC or whatever. Then I read the file at startup and use the entries to set up a dynamic menu or popup or whatever. If the INI or XML file changes I can then adjust the menu on the fly without needing a recompilation or new version to install.
Ken Slovak
|

December 18th, 2007, 05:49 PM
|
Authorized User
|
|
Join Date: Aug 2004
Posts: 95
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi there,
Would you suggest a Local/Network Deployment for this type of add-in?
Thanks,
Arsi
*******(*)*******
|

December 18th, 2007, 06:20 PM
|
Authorized User
|
|
Join Date: Aug 2004
Posts: 95
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Sorry. This add-in needs to be installed on users computers for our company. There may be updates to the assembly in the near future and we do not want to have to install and re-install the add-in on everyones computer so installing all the files for this add-in on the locally would not be as efficient--I think. So, would it be better to put the assembly on a server and create registry entries for each client to be able to use the add-in? Also, do you think it would be possible to do all this with a login script we have for each user which normally pushes all changes to the user as soon as they login?
Thanks again,
Arsi
*******(*)*******
|

December 18th, 2007, 06:27 PM
|
Wrox Author
|
|
Join Date: Sep 2007
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I never recommend installing addin assemblies or other files on a network drive, only locally. It can be done but it's not the most stable way and is completely unsuitable if the user ever wants to run the code when offline.
If you expect a change soon why deploy now? If you have to deploy now I'd put the installer package and setup.exe on a network share and run a logon script to download and install it. If you increment the versioning every time you update then Windows Installer will install the newer files, you can automate it with switches for silent installation and it's all very invisible and easy for the user.
That's how I'd do it.
Ken Slovak
|

December 18th, 2007, 06:42 PM
|
Authorized User
|
|
Join Date: Aug 2004
Posts: 95
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
That makes more sense to me too. Thank you! I've done that in the past, but MSDN documentation threw me off.
Thanks again!
*******(*)*******
|

December 18th, 2007, 08:56 PM
|
Authorized User
|
|
Join Date: Aug 2004
Posts: 95
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Okay :( Now I'm having problems with the installation of the package. This is just not my day or week! Anyway, after the installation is complete and it does say installation complete...I open Outlook 2003, and the menubar is not there! I don't understand what went wrong. Can you please help me again?
Thank you so much!
Arsi
*******(*)*******
|
|
 |