Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Other Office > BOOK: Professional Outlook 2007 Programming ISBN: 978-0-470-04994-5
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 17th, 2007, 08:29 PM
Authorized User
Points: 457, Level: 7
Points: 457, Level: 7 Points: 457, Level: 7 Points: 457, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2004
Location: Burbank, CA, USA.
Posts: 95
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Arsi
Default 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!!!

*******(*)*******
__________________
*******(*)*******
Reply With Quote
  #2 (permalink)  
Old December 18th, 2007, 12:30 PM
Wrox Author
 
Join Date: Sep 2007
Location: Winter Park, Florida, USA.
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #3 (permalink)  
Old December 18th, 2007, 12:54 PM
Authorized User
Points: 457, Level: 7
Points: 457, Level: 7 Points: 457, Level: 7 Points: 457, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2004
Location: Burbank, CA, USA.
Posts: 95
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Arsi
Default

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

*******(*)*******
Reply With Quote
  #4 (permalink)  
Old December 18th, 2007, 03:33 PM
Wrox Author
 
Join Date: Sep 2007
Location: Winter Park, Florida, USA.
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #5 (permalink)  
Old December 18th, 2007, 05:49 PM
Authorized User
Points: 457, Level: 7
Points: 457, Level: 7 Points: 457, Level: 7 Points: 457, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2004
Location: Burbank, CA, USA.
Posts: 95
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Arsi
Default

Hi there,

Would you suggest a Local/Network Deployment for this type of add-in?

Thanks,

Arsi

*******(*)*******
Reply With Quote
  #6 (permalink)  
Old December 18th, 2007, 06:09 PM
Wrox Author
 
Join Date: Sep 2007
Location: Winter Park, Florida, USA.
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm not sure what you mean by "Local/Network Deployment"?

VSTO 2005 SE COM addins don't use ClickOnce technology, you usually deploy them using the Setup project and the SetSecurity project as detailed at http://msdn2.microsoft.com/en-us/library/bb332051.aspx, and for Vista deployment with UAC turned off or for all users in general the information at http://blogs.msdn.com/mshneer/archiv...rs-part-i.aspx.


Ken Slovak
Reply With Quote
  #7 (permalink)  
Old December 18th, 2007, 06:20 PM
Authorized User
Points: 457, Level: 7
Points: 457, Level: 7 Points: 457, Level: 7 Points: 457, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2004
Location: Burbank, CA, USA.
Posts: 95
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Arsi
Default

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

*******(*)*******
Reply With Quote
  #8 (permalink)  
Old December 18th, 2007, 06:27 PM
Wrox Author
 
Join Date: Sep 2007
Location: Winter Park, Florida, USA.
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #9 (permalink)  
Old December 18th, 2007, 06:42 PM
Authorized User
Points: 457, Level: 7
Points: 457, Level: 7 Points: 457, Level: 7 Points: 457, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2004
Location: Burbank, CA, USA.
Posts: 95
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Arsi
Default

That makes more sense to me too. Thank you! I've done that in the past, but MSDN documentation threw me off.

Thanks again!

*******(*)*******
Reply With Quote
  #10 (permalink)  
Old December 18th, 2007, 08:56 PM
Authorized User
Points: 457, Level: 7
Points: 457, Level: 7 Points: 457, Level: 7 Points: 457, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2004
Location: Burbank, CA, USA.
Posts: 95
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Arsi
Default

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

*******(*)*******
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Close all MdiChield form from open one form/Button salman .NET Framework 2.0 6 December 10th, 2007 03:21 AM
how to open a new VB 2005 form from a button? asimzeeshan Visual Basic 2005 Basics 4 August 20th, 2006 11:25 AM
HELP!!!Coding a command button to open a form solva Beginning VB 6 5 May 10th, 2005 09:56 PM
Setfocus from button on Commandbar simmy Access VBA 2 December 29th, 2003 11:45 AM
Setfocus from button on Commandbar simmy Access 2 December 29th, 2003 11:31 AM



All times are GMT -4. The time now is 10:22 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.