Outlook Addin Automatic Update from Internet

Answered Outlook Addin Automatic Update from Internet

  • Tuesday, August 21, 2012 5:18 PM
     
     

    Hi,

    I have a requirement of writing an addin for outlook. This addin should automatically get updated as and when new releases of this addin are available. It should be a pull from user's outlook which should update itself automatically when the new version of the addin is available. I read and tried some of the content mentioned in the forums but all of them need me to publish the code and make it available manually to the shared location. Is there a way that i can publish the addin code to some server say http://localhost:8080/publishedAddIn and access the same in my outlook via a url so that whenever a new version is available my outlook downloads the latest version from net.

    Please advice any solution /useful links for the same.

    Thanks

    Arvind 

All Replies

  • Tuesday, August 21, 2012 5:47 PM
     
     
    Outlook does not automatically update any add-ins. It is your responsibility to publish your add-in on your web server and code your add-in to automatically update itself.

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.3 is now available!

  • Tuesday, August 21, 2012 6:34 PM
     
     Answered

    actually if you use clickonce deployment technique it will do as you described (of course you have to configure proper options). Look here: http://msdn.microsoft.com/en-us/library/bb608591.aspx

    You can of course go the route Dmitry described - writing your own code, like a grown up man :-D

  • Tuesday, August 21, 2012 7:47 PM
     
     

    Ah, yes, Click-Once! Dinosaurs like myself don't use anything that does not let you drop down to the assembler level. :-)

    Thanks for reminding!


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.3 is now available!

    • Marked As Answer by arvindlaughs Thursday, August 23, 2012 10:34 AM
    • Unmarked As Answer by arvindlaughs Thursday, August 23, 2012 10:50 AM
    •  
  • Wednesday, August 22, 2012 1:03 PM
     
     

    Thanks for the reply .I used the thread above to publish my application and it works completely fine, but one more issue which i am facing currently is that how should i package the external csv files which are residing outside the project but being used by my project. If i use the MSI installer to install the addin , i can package the csv files inside the installer but when i use Click Once to publish my application , how to add the files .

    Any Ideas.

    Thanks

    Arvind

  • Wednesday, August 22, 2012 2:45 PM
     
     
    try to add them to your project in VS and change its build action to content
  • Wednesday, August 22, 2012 4:56 PM
     
     

    Thanks a lot for the reply, I tried the above steps but seems that its not working. One more observation is that once i publish the application with the changes mentioned above the resource file is getting copied with a .deploy extension.  

    Detailed scenario is as below.

    My outlook addin uses some csv files which have to be there in  C:\abc location mandatorily.

    Please let me know how it can be implemented using ClickOnce publish method.

    Thanks

    Arvind

  • Thursday, August 23, 2012 10:33 AM
     
     
    Can i have best of both the world's by having windows installer to install the initial application and copy the necessary files in C:\abc folder but listen to a url for manifest updates something which can be done very easily by Click Once deployment technique. Actually my issue is that my addin needs to use some csv files from C:\abc folder and i don't know how can i use the click once technique to create a folder on C drive and copy the csv file in it.
  • Thursday, August 23, 2012 10:57 AM
     
     
    do those files really have to be deployed with your click once? i mean - you can very easily recreate them from code, even embed them as resources and extract them to this location on add-in startup, if folder is empty or does not exist.
  • Thursday, August 23, 2012 11:57 AM
     
     

    Since i am very new to .net and Click Once . Can you please elaborate on how to do it. My scenario is exactly the same . Any links to code snippet would be great.

  • Thursday, August 23, 2012 12:13 PM
     
     Answered
    you can embed your csv files into your assembly (build action - embedded resource). then in outlook startup event you could check if your files exist at specific location and if not, extract them from assembly and place inside that folder. Look at Assembly.GetManifestResourceStream
  • Thursday, August 30, 2012 8:58 AM
     
     

    Thanks a lot , I was able to publish my outlook addin the way i wanted.

    Only thing which i am seeing is that whenever i open my outlook it checks for update , there is a pop up message saying that its looking for updates for addin. Can i have that popup to run in background or can i configure it to run only when there is a new version published. I am using VS 2010 when i click on project properties-->publish--->Updates I see only three options

    a) Check everytime customization runs

    b) Check for specific time interval

    c) Never check for updates.

    Since i have the requirement to check everytime a newer version is published and force it to the client's machine so i selected option a which says  "check everytime customization runs", now its checking everytime whenever my outlook starts irrespective a new version is there or now. It gives a very bad user experience.I have my manifest file published over a url.

    Please let me know in case there is a way in which i can move that pop up message to background or can run only when there is a new version published.

  • Friday, August 31, 2012 6:23 PM
    Moderator
     
     
    If you're using ClickOnce those are your only options. You would need to roll your own update checker to do things any other way than those supported for ClickOnce.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "arvindlaughs" <=?utf-8?B?YXJ2aW5kbGF1Z2hz?=> wrote in message news:17b031b3-0a1e-4f44-9676-92b888cc5c5a...

    Thanks a lot , I was able to publish my outlook addin the way i wanted.

    Only thing which i am seeing is that whenever i open my outlook it checks for update , there is a pop up message saying that its looking for updates for addin. Can i have that popup to run in background or can i configure it to run only when there is a new version published. I am using VS 2010 when i click on project properties-->publish--->Updates I see only three options

    a) Check everytime customization runs

    b) Check for specific time interval

    c) Never check for updates.

    Since i have the requirement to check everytime a newer version is published and force it to the client's machine so i selected option a which says  "check everytime customization runs", now its checking everytime whenever my outlook starts irrespective a new version is there or now. It gives a very bad user experience.I have my manifest file published over a url.

    Please let me know in case there is a way in which i can move that pop up message to background or can run only when there is a new version published.


    Ken Slovak MVP - Outlook
  • Monday, September 03, 2012 12:03 PM
     
     
    Thanks for the reply. I need to know if there is a way in which i can at least push the the update checker note at the background.

    Arvind

  • Tuesday, September 04, 2012 5:59 PM
    Moderator
     
     
    If you're asking if you can check for updates to your addin in a background thread, yes you can. As long as you don't try to use the Outlook object model in a background thread you can check for updates in the background.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "arvindlaughs" <=?utf-8?B?YXJ2aW5kbGF1Z2hz?=> wrote in message news:c9d936fe-b3c6-4707-bb8e-b64f03ec54a2...
    Thanks for the reply. I need to know if there is a way in which i can at least push the the update checker note at the background.

    Arvind


    Ken Slovak MVP - Outlook
  • Friday, September 21, 2012 3:52 PM
     
     

    Hi,

    I was able to publish the plugin with outlook but one issue in which i need your help is ,When the network speed is slow then when i start my outlook it tries to connect to the location where the manifest file point to. In such a case one pop up is displayed to the user(refer attached screenshot) with a cancel button, when i press cancel button the addin disappears from the outlook top bar.

     Is there a way i can move this popup to background or at least disable the cancel button ?

    Thanks

    Arvind


    Arvind

  • Friday, September 21, 2012 5:26 PM
    Moderator
     
     
    That look like a dialog from the check for updates in a ClickOnce installation. You can't control that or move it to the  background. If you want to customize the behavior or do any update checking in a background thread you'd have to roll your own updater and update check code.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "arvindlaughs" <=?utf-8?B?YXJ2aW5kbGF1Z2hz?=> wrote in message news:818db3ee-59b8-4345-9689-7ef16c6dd534...

    Hi,

    I was able to publish the plugin with outlook but one issue in which i need your help is ,When the network speed is slow then when i start my outlook it tries to connect to the location where the manifest file point to. In such a case one pop up is displayed to the user(refer attached screenshot) with a cancel button, when i press cancel button the addin disappears from the outlook top bar.

     Is there a way i can move this popup to background or at least disable the cancel button ?

    Thanks

    Arvind


    Arvind


    Ken Slovak MVP - Outlook
  • Sunday, September 23, 2012 9:50 AM
     
     

    Thanks for the reply. I guess writing the custom code for checking the updates automatically is the need currently.

    To achieve this i created a button on my application, clicking on which would let me know if any new version of application is available and if yes then it would download the application.

    Since i am very new to .net development ,i followed one of the links on forums to write the custom update code.
    http://msdn.microsoft.com/en-us/library/ms404263.aspx . I deployed the application on client machine and clicked on the button for checking the updates it did not work at all, then i debugged the code on Visual Studio and i see that the flow is taking a lot of time at step  info = ad.CheckForDetailedUpdate(). Its just doing nothing as it executes the above line of code.

    if (ApplicationDeployment.IsNetworkDeployed)
    {
     ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;

     try
     {
         info = ad.CheckForDetailedUpdate();

     }
    }

    One thing to mention here is that i have not used mage.exe to generate the deployment manifest as i was not clear as to why we require that. Also as per the link above there is a mention of mage.exe ? I need to know what does mage does and whats its role in the custom update checker. I guess writing the custom code can check for the automatic updates ? Please clarify.

    Also it would be really helpful if you share any code snippet ?


    Arvind


    • Edited by arvindlaughs Monday, September 24, 2012 3:14 AM
    •  
  • Monday, September 24, 2012 3:35 PM
    Moderator
     
     
    As this is not a ClickOnce deployment, why are you trying to use various ClickOnce methods and such? I don't use any of that and have no idea about mage.exe.
     
    What I do is download and parse an XML file located at a known location at a Web site. That file would have a node for the program name and latest version. If the latest version is later than what's running I prompt the user to see if they want to update. If so I download the update and prompt the user to close Outlook and run the update.
     
    Sometimes I might write a customization of an installer project and in that have code to detect if Outlook is running and if so to close it when the installer is running. For example, the following is an override of the installer Commit action using VB.NET code in this case:
     

    Public Overrides Sub Commit(ByVal stateSaver As System.Collections.IDictionary)

        MyBase.Commit(stateSaver)

        Try

            ' Close outlook if open

            Dim oProcess As Process

            For Each oProcess In Process.GetProcesses

                If oProcess.ProcessName = "OUTLOOK" Then

                    If oProcess.MainWindowTitle.ToString <> "" Then

                        If MsgBox("Outlook must be closed to complete setup. Would you like the wizard to close Outlook now?", MsgBoxStyle.YesNo, "KnowWho") =     MsgBoxResult.Yes Then

                            oProcess.CloseMainWindow()

                        End If

                        Exit For

                    Else ' Orphaned process

                        oProcess.Kill()

                        Exit For

                    End If

                End If

            Next

        Catch ex As Exception

        End Try

    End Sub


    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "arvindlaughs" <=?utf-8?B?YXJ2aW5kbGF1Z2hz?=> wrote in message news:501f1f85-a6c4-4e3b-9205-83bc968b0c89...

    Thanks for the reply. I guess writing the custom code for checking the updates automatically is the need currently.

    To achieve this i created a button on my application, clicking on which would let me know if any new version of application is available and if yes then it would download the application.

    Since i am very new to .net development ,i followed one of the links on forums to write the custom update code.
    http://msdn.microsoft.com/en-us/library/ms404263.aspx . I deployed the application on client machine and clicked on the button for checking the updates it did not work at all, then i debugged the code on Visual Studio and i see that the flow is taking a lot of time at step  info = ad.CheckForDetailedUpdate(). Its just doing nothing as it executes the above line of code.

    if (ApplicationDeployment.IsNetworkDeployed)
    {
     ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;

     try
     {
         info = ad.CheckForDetailedUpdate();

     }
    }

    One thing to mention here is that i have not used mage.exe to generate the deployment manifest as i was not clear as to why we require that. Also as per the link above there is a mention of mage.exe ? I need to know what does mage does and whats its role in the custom update checker. I guess writing the custom code can check for the automatic updates ? Please clarify.

    Also it would be really helpful if you share any code snippet ?


    Arvind



    Ken Slovak MVP - Outlook
  • Tuesday, September 25, 2012 4:37 PM
     
     

    Thanks Ken for the reply. I was able to read the xml file(Application.vsto) to compare the deployed version with the latest version available. In case of version difference the way i am updating the current application with the latest one is by calling the following line of code as below.

    Process.Start(http://abc.com/Application.vsto);

    Am i doing it correctly ?

    The only thing which i see is that once i try to update by calling the VSTO file,there is a popup which appears and ask for installing the application.

    Is there any other way i can update the application by putting the update process in background. If possible provide the code snippets in C#.

    Below is the structure of my application files:

    My Application Deployment contains following files

    -----Application (Folder):

    -------Application Files (Folder)

    --------------App_1_0_0_0 (Folder)

    --------------Design.exe.deploy (File)

    --------------App.dll.config.deploy(File)

     --------------Application.VSTO(File)

    -------Application.VSTO

    -------setup.exe

    Again , thanks a ton Ken for the replies. Eagerly waiting for your reply.


    Arvind

  • Tuesday, September 25, 2012 6:29 PM
    Moderator
     
     Answered
    I don't use what you are trying now, so I can't judge how you implemented it.
     
    I read the version from a Web based XML file, as I said and compare that version value to the runtime version of my addin. If a new version is available I tell the user and if they want to update I download the new MSI or setup.exe. I then start it to update. The installer override action is used to detect and shut down Outlook if it's running during installation. That's how I do it.
     
    C# is just as good as VB.NET, in fact I prefer it myself. However, you're going to have to translate that installer override from VB.NET yourself, I don't have a C# sample handy.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "arvindlaughs" <=?utf-8?B?YXJ2aW5kbGF1Z2hz?=> wrote in message news:5e47c98e-53ca-4b41-8a3f-3041fca34255...

    Thanks Ken for the reply. I was able to read the xml file(Application.vsto) to compare the deployed version with the latest version available. In case of version difference the way i am updating the current application with the latest one is by calling the following line of code as below.

    Process.Start(http://abc.com/Application.vsto);

    Am i doing it correctly ?

    The only thing which i see is that once i try to update by calling the VSTO file,there is a popup which appears and ask for installing the application.

    Is there any other way i can update the application by putting the update process in background. If possible provide the code snippets in C#.

    Below is the structure of my application files:

    My Application Deployment contains following files

    -----Application (Folder):

    -------Application Files (Folder)

    --------------App_1_0_0_0 (Folder)

    --------------Design.exe.deploy (File)

    --------------App.dll.config.deploy(File)

     --------------Application.VSTO(File)

    -------Application.VSTO

    -------setup.exe

    Again , thanks a ton Ken for the replies. Eagerly waiting for your reply.


    Arvind


    Ken Slovak MVP - Outlook
    • Marked As Answer by arvindlaughs Thursday, September 27, 2012 9:56 AM
    •  
  • Thursday, September 27, 2012 9:58 AM
     
     

    Thanks for the answer Ken. It was of great help.

    Is there a way i can restart my outlook after installing the Addin. Currently Am trying to use

    System.Windows.Forms.Application.Restart(), but its not working. Is there any other way i can restart the outlook programmatically in c#.


    Arvind

  • Thursday, September 27, 2012 1:45 PM
    Moderator
     
     
    You need to think about what Application object you're using. System.Windows.Forms.Application has nothing at all to do with the Outlook.Applicaiton object, they are entirely different objects.
     
    Outlook.Application outlookApp = new Outlook.Application;

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "arvindlaughs" <=?utf-8?B?YXJ2aW5kbGF1Z2hz?=> wrote in message news:5bf92a9a-8a55-4b25-a402-a2faf740ce65...

    Thanks for the answer Ken. It was of great help.

    Is there a way i can restart my outlook after installing the Addin. Currently Am trying to use

    System.Windows.Forms.Application.Restart(), but its not working. Is there any other way i can restart the outlook programmatically in c#.


    Arvind


    Ken Slovak MVP - Outlook
  • Thursday, September 27, 2012 2:15 PM
     
     

    Okies, But i don't see any options of restarting on the current Outllook.Application object. I see only quit as an option but that would close the outlook.

    Any ideas how to restart the outlook.


    Arvind

  • Thursday, September 27, 2012 2:21 PM
    Moderator
     
     
    First of all, if you are installing an update to code that's running in Outlook (an addin) you must close Outlook when or before you install the update. Otherwise you're an excellent candidate to crash or hang Outlook and/or corrupt your addin.
     
    I showed you code for the installer that will shut Outlook if it's running in an installer Commit() override handler. Use that code. After installation of the update Outlook should not be running and new Outlook.Application() will restart it.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "arvindlaughs" <=?utf-8?B?YXJ2aW5kbGF1Z2hz?=> wrote in message news:4901577d-5bfa-475d-99ba-4a11c1fad65e...

    Okies, But i don't see any options of restarting on the current Outllook.Application object. I see only quit as an option but that would close the outlook.

    Any ideas how to restart the outlook.


    Arvind


    Ken Slovak MVP - Outlook