-1

My goal is to create an extension for Outlook 2010 to white-list allowed attachments by their file extension and also enable it to "look into" ZIP attachments to check file extensions inside.

I'm very familiar with coding in C# in the Visual Studio IDE, but I've never done an Outlook (or Office) extension before.

  1. So my first question to people who might have tried it -- is it possible to do what I want?

  2. And if yes, can you suggest any resources on how to program such an extension?

PS. I'm coding this specifically for our office set-up, i.e. Windows 7 (client) with Outlook 2010 as email program.

c00000fd
  • 20,994
  • 29
  • 177
  • 400

2 Answers2

1

If you are using Microsoft Exchange, this is controlled by the exchange server, not by the Outlook client. I'm not sure what the restrictions are for other email systems, but I would guess there is usually a server-side filter that would return a "non-deliverable" error if a blocked attachment is found.

You could get around this with your add-in by changing the extension of a blocked file type to something else and adding some sort of note as a .txt attachment or within the message text saying what the original message was. I'll leave design work to you, but it might be nice to have a list where you can add/remove extensions that should be changed to something else.

Once you've set your computer up with the prerequisites for development, I would start here: https://msdn.microsoft.com/en-us/library/bb386094.aspx and browse through the child pages of that topic. I would also take a look at https://msdn.microsoft.com/en-us/library/cc668191.aspx (one of the child pages) for a complete walkthrough.

E. Moffat
  • 3,165
  • 1
  • 21
  • 34
  • Much appreciated. I'll have to look through it. On your first note -- no, we do not use Exchange. Will this make any difference? – c00000fd Feb 17 '15 at 22:03
  • Well, I only mentioned that because of the possibility of the mail server doing filtering itself. It shouldn't make a difference if you're using the method I suggested of changing the attachment extensions themselves, its just something to consider. Exchange isn't the only service that does filtering - I would expect every modern email service to filter attachments in some way. – E. Moffat Feb 17 '15 at 22:09
  • Thanks again. You see, I don't want to block the email itself. I want it to arrive, but so that Outlook doesn't open an attachment by default. I also know that there's a `black-listing` setting in Outlook, or when you specify "bad" attachments. The issue with this is that there are too many "bad" ones to list. Thus I was trying to do `white-listing` instead and also have an option to look into ZIP'ed files and check attachments there. Thus my idea for an extension. It's nice that it's available though. I'll have to read thru your references. – c00000fd Feb 17 '15 at 22:18
1

The Outlook object model doesn't provide anything for filtering attachments. Moreover, it doesn't allow to open attachments on the fly. You need to save the attachment as a file on the disk, see SaveAsFile for more information. Then you can open it for exploring as a regular file. Also you may consider using a low-level API (Extended MAPI) for opening attachments as array of bytes.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
  • Thanks. So you're saying that I shouldn't even try to implement it because it won't let me read & manipulate attachments in a message, right? (It's nice to know this before I actually begin coding.) Also, if so, how do AVPs modify/block those attachments? – c00000fd Feb 19 '15 at 00:50