Outlook scripting in C#? - outlook

I'm using Outlook 2010. Via the Developer ribbon, I see that I'm able to script Outlook using VBA. I'm also aware that you can create Outlook addins through COM that can pretty much have anything as their source language (C# / .NET included).
However, is there any way to actually code extensions to Outlook using built-in Outlook functionality using C#, rather than VBA? If not, are there any plans for Microsoft to allow this in future versions of Outlook?

I'm not sure what you mean by "built in" functionality. Addin can access anything VBA can access AFAIK.
Are you talking about converting the VBA editor to c sharp?

Related

How many ways to develop outlook add in?

I found some ways below.
1. Add-in Express
2. VSTO
3. unmanaged c++
I'm not sure is this right?
And which way can compile only a dll without any dependency.
Using outlook add in, could I get the drag attachment event?
You will be surprised but there is only one way for developing Office COM add-ins - implement the IDTExtensibility2 interaface. All the paths you mentioned follow this pattern and have their own pros and cons.
You can use managed programming languages for developing an add-in as well (C# or VB.NET). C++ is not required. Erlier VS versions had a template for that called "shared COM add-in". VSTO and Add-in Express provides shims (loaders) that create a new Application domain to run your add-in code in isolation from other add-ins. It is up to you which framework to use, or just not to use any.

Disable themes in outlook 2010 via registry

I need to know if it is possible to force a user to use a particular theme (No theme) in Outlook 2010 and also restrict them from being able to change the theme..
There seems to be quite a lot of solutions for outlook 2007 on the internet but nothing for 2010.
Thanks
The Outlook object model doesn't provide anything for that.
You can read the current Office theme by looking at the value of HKCU\Software\Microsoft\Office\14.0\Common.

Developing Microsoft Word add-in for MAC

I have developed a small add-in for Microsoft Word 2011 in VB.net using VS2012. I would like to port the functionality to Mac users. Can you tell me how can it be done?
I have already read these posts:
Developing Word add-ins for Macintosh
VB macro or office addin for mac
But they are referring to Word 2008/2010 where it wasn't possible. I know that since Word 2011 it's possible to use VBA on Mac. But I cannot find any documentation how to use it - all links pointing to msdn/microsoft pages don't exist anymore (like the ones mentioned here: Where can I find the Mac Office 2011 developer details?).
Do you have any resources (documentation, tutorials, books) about the topic?
If it's not possible using VB.net I can switch to C#, but I haven't seen any posts about C# support for MS-office for mac.
The short answer is that you cannot use Visual Studio to develop add-ins for MS Word 2011 and you'll have to use VBA within Word. I assume in your question you mean VB.net in VS2012 not VBA (Visual Basic for Applications is the code written within the Office programs themselves and can't be written in VS). Since VB.net and C# use the .Net framework which is not available for OSX, it is not possible to use VS.
The best you can do is write your VBA code in a Word template (ie .dotm) that exposes your macro through a toolbar (you can't modify the hybrid ribbon in Office 2011). You'll probably also have to use AppleScript (or even C/Objective-c) to make up for some of the short falls in Mac VBA. Things like FileSystemObject, ActiveX controls don't exist and File Dialogs are limited so if possible you'll need to find AppleScript equivalents (which can easily be run from VBA).

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.

Outlook 2003 Addons

I want to create a custom Addon/plugin for Outlook 2003, to support integrated functionality with a task management system.
I am unable to find many good development resources for the same.
Can someone please explain Outlook 2003 architecure and development of a plugin.
Good links/resources are also welcome.
Here is a tutorial on outlook architecture getting started building Outlook 2003 plugins from MSDN:
http://msdn.microsoft.com/en-us/library/aa289167.aspx
There is also a huge list of resources here: http://www.microeye.com/resources/res_tech_vsnet.htm
Good luck!
What you want can be done.
The bottom line is that you need to use Visual Studio 2005 or Visual Studio 2008 plus Visual Studio Tools for Office (VSTO) plus Outlook 2003 (of course) to build an "Adddin" for Outlook.
Addins are quite complicated to write mostly because Outlook has eccentricities that are not well documented. For example, a method Outlook.MailItem.GetHashCode() is not always the same even for the same object despite what you might expect from something as seemingly absolute as a 'HashCode' for an object. Knowing that and many other quirks of the VSTO+Outlook API are for what the professionals get paid. There are MANY quirks. If you are learning then you will need to start with the resources Gdeglin has provided.
Also look at the MSDN VSTO forum:
http://social.msdn.microsoft.com/Forums/en-US/vsto/threads <- very active!
And Outlook code: http://www.outlookcode.com/
Also here is a Google search on MSDN for various VSTO 'tips'.

Resources