Hello, Hopefully someone would have some advice, I'd like to trigger an action inside outlook from outside outlook. I.e. pop-up a new contact window for the user to access. Should I approach this from a mapi standpoint or use IPC with a VSTO add-in inside of Outlook... I'm not sure what the "most correct" way to go about this is.
Thanks!

Best way to do this?
RKasi
Hi,
Sorry for delayed reply. I was out of office for a while.
If you are distributing Interop.Outlook.dll and referencing that in your code then you have an easier solution.
In you application, check for Outlook installation (thru registry entries or another means. You can probably find info on the web) and do not instantiate any class defined in Interop.Outlook.dll if Outlook is not installed.
I am not 100% sure, but as long as you don't instantiate any Outlook objects you should not see any error. As far as managed code is concerned, it will JIT against Interop.Outlook.dll code.
Now, if you were referencing the Outlook PIA in your application and not distributing Interop.Outlook.dll then your app will fail on machine without Outlook because .NET code will not be able to load the PIA.
You might want to test this out. Hope this helps.
mosa
I would take that route but my application will be used by many users who don't have outlook, the outlook features are more like "icing" on a cake if that makes sense... So I still need to figure out how to do this. I've heard people mention late binding before which sounds like it would do what I need...but I don't know much about it
Thank you
Jarrod-Brotherton
Just as a warning in case you run into it ...
You may run into what is known as Outlook object model guard. There are certain actions that are blocked by Outlook when you are automating it from out-of-proc. I think Outlook will pop up a message box asking user for permission to perform the action.
I don't know a whole lot of details but you can find more information about it on MSDN.
David Flood
Well, I'm far from being an expert, but in my opinion an Outlook add-in is meant to create functionality from within the application... since what you need is to trigger an action from outside Outlook, I would rather simply use the Outlook Object Model from a different app.
For example, to create a new appointment in Outlook from a different app I use this code in VB.NET:
Don't think that's the best code sample you'll ever find, but that's just an example of how I do it, and it works!
Oin Zea
Hi,
I think that would be too much trouble :-). Why don't you create an MSI installer which checks for Outlook to be installed If Outlook is not installed you can pop up an error message and not install your app.
Ravi Kant Kumar
Daniel,
Thank you for the suggestion, the problem is that I don't want to recode the new appointment window =/. I just want to pop it up and let the user enter the data (save for maybe a field or two that are automatically populated by my code).
Any ideas
Thanks!
ZJames
Well, maybe I'm getting the whole idea wrong... but if I'm not, then you could reuse that code and take away all this lines:
That way your app would show the window to the user, but it wouldn't fill any info... giving the user the option to do as he wishes...
rajeshbhavsar
Thank you for the help, a little magic converting to C# and it works nicely. The outlook security manager dialog only comes up when I access contacts/send e-mails through the OOM. Appointments are fine (though I want access to the contacts!). I'll probably grab the security manager from www.add-in-express.com to solve this then.
I guess this leaves me with one question... what happens if the user doesn't have Outlook on their machine and my application references it I'll be distributing the Interop.Outlook.dll anyway...but I'm sure it'll crash. Should I try putting the code in a seperate dll file and using reflection to load it
Thank you again! =)