Outlook 2016 Add-in not working - outlook-addin

I am working on an Outlook add in and it works fine for all the browsers. However it does not work with Outlook 2016. Initially it worked with Mac, but now it doesn't seem to work with either. It seems like the Office.initialize is never called?
I've searched and tried things for hours but nothing works. Comparing my manifest and initialization to others, I seem to have essentially the same code.
I used the yeoman generator and I am using Office UI Fabric React as my framework. Really at a loss at this point, wondering if anyone has any suggestions or a way to see if any errors are thrown in the Outlook Desktop app?
Update
After much searching and trying things, and starting from scratch, it seems that the add-in stops working as soon as I start using the Office-JS API. Specifically I'm getting the userProfile and the to, from, cc fields from the email Office.context.mailbox.item.
Still unable to find a solution.

When using Office-JS APIs, be sure to call those APIs only after Office.initialize has been called.
Beyond that, there are a few options for debugging add-ins in Outlook 2016. The last section on this page describes how to attach the Visual Studio debugger to the process running the add-in. Be sure to enable Script Debugging in IE options.
There also are a couple of newer options for debugging Office add-ins:
Launch the Visual Studio debugger from a task pane (in Outlook, I right-clicked on the task pane to see this option)
On Windows 10, debug using F12 tools (simple to use, and doesn't require Visual Studio)
For an Outlook add-in running in OWA, just open F12 Developer Tools in any web browser.

Related

How to debug a Word OfficeJs command-only add-in

I am trying to write my first JavaScript Word add-in using Visual Studio Code. As a basis I used the Simple Word Add-in example provided by Microsoft. The example puts all JavaScript code in the commands.html file. I would like to put my code in the separate commands.js file, and use the Word Javascript API instead of the Common API. But with most changes Word just does not respond and I can't see what's happening at this stage.
I have installed the Microsoft Office Add-in Debugger Extension for Visual Studio Code. All examples that I have seen are task pane add-ins, and I was able to attach a debugger to those examples. Is there any way to debug a command add-in (without a task pane)?
Unfortunately the Microsoft Office Add-in Debugger Extension for Visual Studio Code will not work for debugging commands. In order to debug commands, your best bet is to upload your add-in manifest to Office Online, view it in Edge or Chrome and use the DevTools (F12). You should be able to add the add-in project source in the DevTools and just set breakpoints in the commands.
If you are running the Edge Chromium (which I don't think you are based on the fact that Microsoft Office Add-in Debugger Extension worked for taskpane add-ins), debugging commands can all be done in VS Code.

VB.Net Word Add-in has automatically installed itself

I am developing an add-in for Word to add ribbon bar functions for our business.
I am developing the add-in in VB.Net using Windows Visual Studio 2017.
The machine is currently a stand-alone machine that is not connected to the main network.
My issue is that for some reason, the add-in seems to have set itself up in such a way that it appears to have already been installed on the system and loads, with the most updated code, if I just start Word normally.
Any development has been done in Debug mode and I have not been re-building the solution in release mode, and yet anything I change and then run/debug updates the code that the add-in appears to be run off when opening Word directly.
If I go through the options --> add-ins and disable the VTSO add-in it just gets enabled again. I don't seem to be able to separate a debug/development section and live code.
Edit from comments: I can accept that the VTSO needs to be installed and registered but having no separation of live code and development code is frustrating. This machine is used by others for other purposes and this includes using Word, and so any old code must be kept as comments that can set back as the working code should I need to leave part way through. I cannot leave anything partially written as any run the debug mode will set the code as live.
What you're experiencing is normal behavior. When you debug, VSTO registers the add-in in the Windows Registry. This is all that's required for the Office application to find and load the add-in when it starts.
If you disable the add-in in Word, it will remain disabled until you again debug the add-in in Visual Studio.
If you share the machine and want to have the add-in under development disabled for other users:
Work with separate user profiles. VSTO registers its add-ins under CurrentUser, not for all users - VSTO isn't designed to register add-ins for the entire machine. OR
Get into the habit of using Visual Studio's Build/Clean Solution functionality when you leave the machine. That unregisters the add-in (until it runs in debug mode again).

VSTO Addin for Outlook won't work

I've seen tons of posts and sites that address this issue. I've tried every solution I've found but none of them work (I've been trying to figure this out for days now). I have seen many posts with the same exact sounding issue, but either the solution didn't work for me or isn't applicable. With that said...
I have an add-in for Outlook 2007 that is intended to add text to the an email's title and body. It is installed for all users using an .msi file. There is an older version that I deployed last year that works fine. The new version I created has only a few minor input/output changes, nothing major. This new version works perfectly on my development computer in both debug from Visual Studio and from an actual install. However, I can't get it to work on a non-development computer. Here are the details on the program and target computer (development computer and target computer details are the same other than the fact that the target computer doesn't have Visual Studio):
-Using Visual Studio Professional 2013
-Written in Visual Basic
-Target Framework is .NET 4.0
-The add-in is only run once the "send" button on an email is clicked.
-Outlook version is Outlook 2007
-Operating system is Windows 7 Enterprise SP1 32-bit
The problem is that the add-in won't load on the target computer(yes, I know, a bazillion other people have had the same issue). As I said previously, it works fine on my computer in both debug and installed versions. This made me think that the other computer is missing something, so I tried installing the .NET 4.0 framework onto the target computer but it told me that it was already installed. I ran through everything I could think of to get it to work with no avail. Here's how it behaves:
-Installs fine with no errors.
-HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Office/Outlook/Addins/EmailMarkTool/LoadBehavior = 3 after installation.
-VSTO_LOGALERTS = 1
-VSTO_SUPPRESSDISPLAYALERTS = 0
-Outlook opens with no apparent errors.
-LoadBehavior = 0 immediately after Outlook is opened.
-Shows up in the Add-ins under "Inactive Application Add-ins."
-Never shows up under "Disabled Add-ins."
-In the "COM Add-Ins" dialog where I can check which add-ins to use, it shows the correct directory and the Load Behavior is "Unloaded."
-The add-in can be checked. When I click "OK" I don't get any errors. When I go back to the Add-ins, it is unchecked and "Unloaded" again.
-Setting the LoadBehavior to 3 doesn't help because it goes back to 0 as soon as Outlook is started again.
-I inserted a try-catch block into the New() function of the add-in that has a MsgBox pop-up and a Throw.
-I get absolutely no errors anywhere.
-No log file is generated.
I have tried uninstalling, rebuilding, and reinstalling multiple times all with the same result. I just can't figure out why it will work on my development computer but not the target computer. Thanks for reading all of this. I know it's a lot, but I needed to get the details out. Thanks in advance for any input!
[UPDATE]: I just created a brand new minimal add-in just to test if it would work but got the same results.
I found the problem!
The problem may be unique to Outlook 2007. It turns out Microsoft Office 2007 SP1 and SP2 had a bug that prevented it from running VSTO addins. Microsoft released a hotfix that fixes this issue (https://support.microsoft.com/en-us/kb/976477). This was added in to the release of Microsoft Office SP3. However, to activate the fix, a new registry flag must be created but that isn't automatically done with the fix, making the fix useless until you manually activate it (instructions and download here). So...
To enable VSTO addins in Outlook 2007, you have to add a subkey to this registry: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\12.0\Common\General\
and add a DWORD "EnableLocalMachineVSTO" with the value set to 1.
I did this, restarted the computer for good measure, installed my addin for the 23rd time, and it installed and ran perfectly! I'm not sure how previous versions worked, though. It's possible that our system admins removed that subkey in an effort to bolster security at some point.
The loadbehaviour key problem you are experiencing is strange. Whilst I think this is probably not your solution, it could be, so its worth a try.
The target computer will need to have VSTO tools for office runtime installed.
You can download these tools are the following link - https://www.microsoft.com/en-GB/download/details.aspx?id=48217

Visual Studio Tools for Office VSTO "customization assembly could not be found or could not be loaded"

I just installed Visual Studio 2012 Ultimate and I am trying to create a managed code extension project for Excel 2010 (32 bit Office Professional Plus). I have tried using the .NET 4.0 template contained in VS Ultimate for an Excel 2010 workbook. When I create the project everything looks fine until I run it.
Excel opens and I get the error message "The customization assembly could not be found or could not be loaded. You can still edit and save the document. Contact your administrator or the author of this document for further assistance." The details section is blank.
I have tried everything I could think of to figure this out and I have run out of ideas. I removed all addins from Excel except for the VSTO Design-Time Adaptor for Excel. I removed all personal macros. I set every directory I could think of to "trusted" in Excel and lowered the security settings for all options to "enabled (not recommended)". I completely uninstalled Visual Studio and re-installed. There are no errors or warnings showing up in Visual Studio. I also checked to make sure ".NET Programmability Support" was installed for my copy of Microsoft Excel.
I would link my code but I haven't written anything. I can't even get the default template to load when I run the project. A few others at work have the same setup as me and VSTO runs fine for them using the same steps. I even had someone send me a working project but it gives me the same message when I try to run it.
Is there anything else I can check to see where the problem is occurring? I tried setting break points in the project but it is failing before it gets to any of them.
Thanks so much for your help.
I've run into the same problem with Visual Studio 2010.
I isolated the problem to an SSRS reporting link we were trying to run from the add-in. I removed all the reporting stuff (service reference, sub-dirs, etc.) - the add-in runs fine.
We just ran into this and discovered that a method had a system exception that was not handled. It was hard to track down but once the culprit method had an exception handler the customization finished loading properly.

My VSTO 3.0 Outlook addin doesn't load

I'm trying to diagnose why my Outlook plugin written in C#/VSTO 3.0/VS 2008 doesn't load after being installed.
The plugin works awesomely on my development machine, which has Visual Studio 2008 installed. I can't expect all my users to have all the prerequisites though so I went through these steps to write an installer:
http://msdn.microsoft.com/en-us/library/cc563937(loband).aspx
I installed the add-in on a fresh Windows XP SP 2 machine with a fresh install of Outlook 2007. It installs all the prereqs ok (.NET 3.5, VSTO 3.0 runtime, Windows Installer 3.1, 2007 PIAs). Outlook starts but the add-in isn't run. If I go to the Add-ins tab in the Trust Center, I see my add-in in the "Inactive Application Add-ins" section with the message "Not loaded. A runtime error occurred during the loading of the COM Add-in.".
Not sure how to find the specific error so I can fix it.
The reg keys look ok. Under HKEY_CURRENT_USER\Software\Microsoft\Office\Outlook\Addins\BlahAddin I see Description, FriendlyName, LoadBehavior (set to 3 until it fails after which if becomes set to 2), and Manifest.
Tried the VSTO_SUPPRESSDISPLAYALERTS environment variable trick and then launched Outlook from the command line but no output came out.
I have remote debugging more or less working but I'm not sure what to look for. I don't see my DLL loaded when I attach to Outlook, but then again maybe managed DLLs don't show up the same way in VS.
Any other ideas on next steps I could follow to produce a specific error I can diagnose?
Solved my problem after weeks of pain. The "Manifest" reg key was getting corrupted to some junk value during the setup build. It was a known Visual Studio bug that supposedly got fixed in Visual Studio 2008 SP 1, but apparently wasn't for me. Renaming the project name to be different from the plugin name fixed the problem. Random, huh?
Make sure you have try-catch handlers at the top level of all methods called by Outlook and log any exceptions you are unable to handle in some way. Focus your troubleshooting on methods like the Startup method and other methods called during initialization.
You probably want to debug this using the remote debugger. Share out the MSVCMON.EXE folder from your developer machine (in your Visual Studio folders in Program Files) on your test machine (share it with a UNC path), and launch Outlook under the debugger trapping (.NET) exceptions in your modules and putting breakpoints in your methods.
If you need to clean your test computer each time before you install your solution, you should probably run XP under a Virtual PC 2007 VM (free download) and switch to a differencing HD after setting up everything but your plugin to snapshot your pre-installed state once so you don't have to keep uninstalling/reinstalling as you make changes to your program to fix bugs.
Are you installing Debug builds or Release builds? Perhaps one flavor has different requirements. Just guessing.
-Mike [MSFT Office Dev]
On your machine, when you run the addin from Visual Studio, it should create a registry key in HKEY_CURRENT_USER\Software\Microsoft\VSTO\Security\Inclusion{SomeGuid}. Make sure that these registry settings are also being deployed with your addin. They are the ones that allow your code to be trusted.