RequestComAddInAutomationService is not being called in VSTO Outlook addin - outlook

I have an application level Outlook 2010 VSTO addin and have overriden the RequestComAddInAutomationService function. On two development PCs (1 with Outlook 2007 and one with Outlook 2010) I have tested the code with Visual Studio 2012 and the function is called.
Protected Overrides Function RequestComAddInAutomationService() As Object
MsgBox("Request being Made")
If dbShortCutCtrl Is Nothing Then
dbShortCutCtrl = New DBShortCutKeyController
End If
Return dbShortCutCtrl
End Function
The problem is when I deploy the addin this function is not called. The addin functions as expected it is just this function is not called.
What could the reason be that this function is not called when VSTO starts up with Outlook?

It turns out that the Class DBShortCutKeyController is not being registered for COM properly and thus this function is not being called.

Related

Outlook Addin Office Intitalize function in visual Studio 2017

I am developing an outlook addin using visual studio 2017 outlook web addin template.
I want to handle the event when the addin was first installed.
How can I get the installation event.I refered this link but its not giving me any event information for addin.
Office.initialize is used for determining when an add-in is launched and the runtime is ready. When the event is invoked, it means that all Office.js APIs are ready to use. There is no event for when add-ins are installed. If you are looking to create a "First-Run" Experience, you may use the RoamingSettings object to set some kind of mark if user went through your guide and doesn't want to see it any longer. This object will be available right after Office.initialize, so you can try to get this mark (key) and redirect to your app page(s) or your guide page(s) according.

Is it possible to override Visual Studio 2013 Notification window

Notification window is a new added feature in visual studio 2013. I have an isolated shell application created using visual studio 2013 shell.
Is it possible to extend the Notification window and show notification or information related to our isolated shell application ?
The answer to your question would be yes, however Microsoft does not expose the functionality officially. You can expose these structures yourself, if you're super interested.
The way you can do it, is kind of hackish, but it will work, at least for VS2013. Basically, you need to either reference an internal dll (C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Microsoft.VisualStudio.Shell.UI.Internal.dll), or just copy/paste the relevant structures into your own program, as Kevin has done: User Notifications in the Visual Studio 2013 SDK.
If that is done, you can exploit the interfaces: https://github.com/kevfromireland/visual-studio-2013-notifications-example/blob/master/UserNotificationDemo/UserNotificationDemoPackage.cs
var notificationService = (IVsUserNotificationsService)GetService(
typeof(SVsUserNotificationsService));
var notifcationManager = notificationService.
GetUserNotificationsManagerAsync()
.GetResult();
var vsUserNotificationsManager = (IVsUserNotificationsManager) notifcationManager;
var pic = new RedditPicProvider().GetAwwPicture();
vsUserNotificationsManager.
AddUserNotification(ExampleProvider.Guid,
pic.Url,
pic.Title,
pic.Url,
(uint) NotificationServerity.Critical, isTransient: true);
RegisterNotificationProvider(vsUserNotificationsManager);

Outlook 2010 not launching when I debug my Outlook addin?

I'm totally confused as to how to debug an Outlook 2010 addin I'm trying to develop. I created a new Extensibility | Shared Add-in project and just checked Outlook, and it's created a new project for me with a stub implementation of the Extensibility.IDTExtensibility2 interface in my Connect.cs file. However, when I press F5 to debug, although the project compiles OK, a new instance of Visual Studio opens up instead of Microsoft Outlook! How am I supposed to debug my addin?
Since Outlook is the host process that will load your code you have to make sure that Outlook is the target application for debugging (go to project properties and select the main Outlook EXE under the Start external program option in the Debug settings).
Then of course you have to also make sure that your plugin is actually being loaded by Outlook. With that in place you should be able to debug your plug-in with VS.

Calling Visual Studio Excel add-ins from Excel 2007

I am very new Visual Studio (just downloaded version 2010 Professional), but I believe this is the right way to do web services in excel.
Have created a Excel 2007 Add-In called TestAPI within Visual Studio containing just one class ThisAddIn, the 2 default StartUp and Shutdown procedures and 2 functions I have written myself, say f1 and f2.
When I start Excel 2007 and check Excel Options i can see it as a COM add in, but how can I see these 2 functions within VBA? Any references to either ThisAddIn or TestAPI or f1 or f2 all fail, yet if I put something into the StartUp functions this will automatically be executed whenever I start Excel, which I do find quite annoying. It seems that COM Add-ins are switched on/off at Excel level whereas I cant seem to find the TestAPI anywhere on my list on References (where I could check or uncheck it as required depending on Excel sheet).
I am probably missing an (or multiple) point(s).
Paul Stubbs has some information on calling VSTO UDFs from VBA on his blog.
Alternatively, you could try building a more vanilla COM add-in for Excel, as described by Eric Carter.
My personal preference for creating user defined functions is to use ExcelDna.
Have you declared F1 and F2 Public? In the class ThisAddin
Public Shared Function F1(x as Object) as Object
Return x*2
End Function
(I'm not sure if Shared is required in VSTO, I use Addin Express, VSTO is such a pain)

Please explain what an outlook add-in is

Can someone give me a quick explanation of when I would use Visual Studio 2008 Outlook 2007 Ad-In project type? and how would that compare to developing a bunch of outlook macros directly in outlook?
Basically, I want to have some sort of application read email (with attachments) from a pop3 email box, do some filtering/editing/validation of the subject/sender/content and then if certain conditions are met, save the attachments to a local file, and then add an entry into an SQL server database table (i.e. date/sender/subject/message).
Seems there are at least 10 different ways to do this....so between an outlook macro and a VS Office Project, how do I pick?
I am not clear, if I create this solution as a Visual Studio outlook add-in, where does it run? Is it loaded into outlook, does it run as a separate process and communicates back and forth with outlook? if outlook is not running, does it start it?
An Outlook Add-on is a compiled component that uses the Outlook API to perform the tasks you need. A macro/VB script is an interpreted script that actually uses the same API. The add-on approach is better if you want to deploy your functionality.
When you work on an Outlook add-on in Visual Studio, you'll be creating a .NET component, which integrates into the Outlook application, which is written in C++ so uses COM. You'll have to be careful about managed/unmanaged types and releasing objects you retrieve from Outlook.
I have recently completed just such a tool, but I chose to use Add-in Express (http://www.add-in-express.com/). These guys provide a layer of abstraction over the [challenging] Outlook API and also provide some excellent support if you're stuck.
In my case, with Add-in Express, I "run" by setting Outlook as the application command to run, in the Project properties. Add-in Express sorts out the installation of the add-on within Outlook. So when I press "Run", Outlook starts and my add-in is displayed, which may be debugged in the normal fashion. I'm not sure how VSTO (Visual Studio Tools for Office) works in this respect - or at least, I can't remember.
This is an example of an outlook add-in..
Personally, I don't see macros distributable.

Resources