PDA

View Full Version : Solved: Custom Action



mvidas
09-14-2006, 11:42 AM
Hi Everyone,

I need help.

Not the professional psychiatric kind (too cheap for that! though I could use it...), I need help with performing specific actions on specific new messages.

I use outlook 2000 (SR-1). I know, I know, but I can't do anything about that. Currently I have rules send the message to a specified folder, and I have my application_newmail sub check for unread messages in that folder. I can live with this but I don't like it (I want to be able to give this to other people I work with), I don't necessarily trust the PC skills of some coworkers so I'd like something a bit more idiot-proof than asking them to create a specific folder with a specific name and not to rename it on a whim. I know I need to be more trusting, but see above about seeing a shrink.

I want to know about custom actions.
I've been to http://www.slipstick.com/addins/custom.htm
Do I have to make a DLL to hold my custom action, or is there a way to use VBA? Longshot I know, but couldnt hurt to ask. But assuming I have to make a DLL..
Do I have to make this DLL in c++ or can I use vb6?
Does someone have a DLL I can look through to understand how it receives the specific message I send it?

Any and all help is appreciated!
Matt

Tommy
09-14-2006, 02:11 PM
I know I need to be more trusting
Sounds like to me you got burned just enough to start thinking that way. :)
VBA will let your users modify it. Com-addin will not.
No it doesn't have to be C/C++ it can be VB6. This is the method I would use FWIW. I have written 1 for word and 1 for excel. I can give you a copy of the one for word. see Spell Check a Form (http://www.vbaexpress.com/forum/showthread.php?t=56)

They are all similiar different object models. Once you are familiar with the object model the rest is easy, well at least you have a clue anyway hehe.

mvidas
09-14-2006, 04:08 PM
Thanks Tommy :) I never knew you were dragontooth, now I know you from more than here!

I'm pretty familiar with the outlook model, its been my new hobby the past couple months playing around with it. I downloaded the word dll but as I only have a minute I tried quickly to open it in vb but it wouldn't let me load it, I'll try later as well. I didn't realize i could use a com add-in for a 'custom action', this will give me an actual reason to create a com add-in (I usually only practice at work and don't have vb there). I'll let you know how it goes!

Sounds like to me you got burned just enough to start thinking that way.Not really, I just want to avoid it :)

Tommy
09-14-2006, 04:23 PM
You weren't supposed to see that part LOL.

Download the project, I forgot how to do the install on the dll but it something to do with regsvr32 maybe could be the location also. I'll get back on that one, Sorry.

A com add-in is a compiled/linked version (dll) of an add-in, I think at least that is the way it seems to work for me. :)

I'll help where I can just let me know.

mvidas
09-15-2006, 06:52 PM
I am having no luck with this, seems like an exercise in frustration. Seriously considering buying one of Sue Mosher's books!
I really really wish we could use outlook 2002 or greater, to have the "run script" option in message rules :(

mvidas
09-18-2006, 06:45 AM
FYI posted at EE as well http://www.experts-exchange.com/Applications/MS_Office/Outlook/Q_21993234.html

mvidas
09-18-2006, 07:08 AM
Rory from the Excel TA of EE posted about the AdContac example from MS ( http://support.microsoft.com/?kbid=198725 ) .. amazingly I had not seen that before, the included source files seem to be exactly what I wanted. I can't play around until I get home though

mvidas
09-18-2006, 09:07 AM
For my information: http://www.microsoft.com/downloads/details.aspx?familyid=4afe3504-c209-4a73-ac5d-ff2a4a3b48b7&displaylang=en - Exchange SDK download

Tommy
09-19-2006, 02:26 PM
This one deals with making com-addin and some sample files in outlook
http://www.thecodenet.com/outlook.php

events
http://www.thecodenet.com/articles.php?id=12

I have a project that deals with the contacts, adding, updating and searching. if you want to look at it. It was developed along with JamesCol in this thread, and I took it someplace else LOL
http://vbaexpress.com/forum/showthread.php?t=452

btw all vb/a no c/c++ whew

I'll be back -

Later

mvidas
09-20-2006, 06:40 AM
Great links!

I wish I'd seen http://www.thecodenet.com/articles.php?id=38 over the weekend, I stumbled through making a com add-in (and did get it to work correctly), your links make it much easier.

My project that made me want to learn a custom action is changing (with me steering it). I did successfully make a custom action after learning enough c++ to get it to work, but it wasn't all that friendly and as I'm not one-with-the-language it would be a pain to maintain when necessary. I had decided to just use vba and the outlook.items collection events, but I found out the primary user (a friend/coworker) has outlook 2000 SR3. So he has all the security annoyances but none of the features of later versions. I'm told the com add-in will circumvent the security prompts, so I think thats gonna be the way I'm going. I just wish I could either install vb6 here at work or find a command line compiler (that wouldn't require an installation--no admin access), as it is now I have to do my work like this at home. Probably better that way -- as this has zero to do with my job -- but it would still be nice.

Thanks for all your help! I'm gonna mark this as solved, but don't let that stop you from posting anything else if you think of something :)

Matt

mvidas
09-20-2006, 08:21 AM
Got a question for you Tommy, though I can move this to a new thread if desired.

I'm writing the code for my add-in right now, and part of it is to check the messages in a specific folder (in outlook). I have the folder's path hard coded right now, but I am giving the user the option to choose a different one if the hard-coded one does not exist.

I want to be able to store the path if the user chooses it so they wont have to go through that every day. Can you think of a good way to store this data?

I could use a text file, but I'd prefer not to if at all possible. I could also store it in the registry (which to me seems like the only feasible way), but I wondered if you had another idea how I could store it right in the addin or something.

Thanks!
Matt

EDIT: I did end up using the registry for this, I didn't think I'd be able to put nullchar's in the registry but apparently I can! I'd prefer not to use the registry if I didn't have to (ie if you know of a way I can store this information), but I suppose it isn't the end of the world.

Tommy
09-20-2006, 02:41 PM
Have you though about the resource file? I have some samples but the notice in them says I can't post but I can send them to you. :) you can use it for personal use (to learn). There are also some samples at MS but I don't have them handy at the moment will post them a little later.

mvidas
09-20-2006, 02:54 PM
Resource file? Hmmm... dont know anything about that but I'd love to learn!
On an unrelated note, my email address is mvidas at hastalavidas dot com

I read at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dno2kta/html/mso2kaddin.asp about the advanced options of the designer module how you can specify a registry entry, but I ended up just using my own at hklm\software\mvidas\addinname
The only reason I may keep it there is because the two things I'm adding there I would prefer to keep there after the add-in is uninstalled (should I release a newer version I dont want the user(s) to have to set it up again).

Also on that page (regarding the resource file):

On the Advanced tab of the designer, you can enter the name of a resource file, a subkey to store additional data, and the data you want stored at this registry subkey
Is the resource file the same as the "satellite dll"?