100011

I already asked this question but nobody answered it. If nobody knows the answer please let me know and I will search for an alternate solution.

I am trying to create an AddIn for Outlook. The AddIn is used to auto populate the "To..., Cc..., and Bcc..." on a new message from data I have stored in a database. Does anybody know how to create or overload an event handler for the text fields where a user enters the To... Cc... and Bcc... Email addresses



Re: Visual Studio Tools for Office VSTO Outlook Addin Help

Sue Mosher - Outlook MVP

No useful events fire when the user types into those controls.



Re: Visual Studio Tools for Office VSTO Outlook Addin Help

100011

Is there any other method of controlling what data gets displayed in the auto fill boxes for the To... Bc... Cc...





Re: Visual Studio Tools for Office VSTO Outlook Addin Help

Sue Mosher - Outlook MVP

I'm not sure what you mean by "the auto fill boxes" or what you have in mind for your application to accomplish. What Outlook displays in its standard address controls are the text that users type in or resolved (underlined) addresses. Both can be set programmatically.



Re: Visual Studio Tools for Office VSTO Outlook Addin Help

100011

If an addin can not be used to auto populate the "To..., Cc..., and Bcc..." on a new message from data I have stored in a database, than another visual studio solution would be ideal. The To..., Cc..., and Bcc... text boxes are the auto fill boxes I am speaking of. Is there a visual studio addin or other solution for setting this data programmatically avaliable, and if so where can I get more information on this Thank you for your help.





Re: Visual Studio Tools for Office VSTO Outlook Addin Help

Sue Mosher - Outlook MVP

As I indicated, it certainly is possible to programmatically set those values. Either set the message's To, Bcc, and Cc properties or call the Recipients.Add method to add a recipient. Those MailItem properties and method are described in Outlook developer Help and on MSDN.

Please note that your original question asked about writing an event hanlder, which is quite a different issue.





Re: Visual Studio Tools for Office VSTO Outlook Addin Help

Mike Walker

You dont really explain what the end goal is with your solution, as Sue says you can set these properties before sending an email or loading an inspector window but cant prevent them editing these settings without adding a custom form for the mail item type to remove these.

Regards






Re: Visual Studio Tools for Office VSTO Outlook Addin Help

Sue Mosher - Outlook MVP

It would take more than a custom form (and custom message forms are rarely a good idea). You'd have to disable the Address Book command.



Re: Visual Studio Tools for Office VSTO Outlook Addin Help

100011

If it helps I will try and clearly define the end goal.

End Goal: I want to auto populate the "To..., Cc..., and Bcc..." on a new message from data I have stored in a database. This means that the only email addresses that will show up in an auto populate list are the addresses from a controlled list.

Reason for End Goal: We currently have the Advanced E-mail Options "Suggest names while completing To, Cc, and Bcc fields" unchecked because of security purposes. When this is enabled it will auto fill with emails from recently sent email addresses typed into the field, it auto fills from personal contacts, auto fills from the global address book, and probably other areas as well. In any case it could result in security violations. If the email addresses of auto populated addresses could be controlled more securely it would be our ideal end goal. This would only allow email addresses to be auto populated from a specific list, which in my case a list of email addresses stored in a database.

Possible Solutions: In the original post I mentioned what I believed to be a possible solution (i.e. an event handler) for this "end goal". I am also aware that there is more than one way to skin a cat, so if a better solution is available, I am very interested in hearing what the best solution for this would be.

If I need to be more descriptive in what I need in an end goal please let me know, and again I appreciate your help in finding the best solution.





Re: Visual Studio Tools for Office VSTO Outlook Addin Help

Sue Mosher - Outlook MVP

The "Suggest names" feature does not do everything that you are attributing to it. All it does is give the user suggestions, based on data that has been typed into the address controls. Those suggestions consist of addresses that have been previously used to send messages. It does not fill in any names by itself. The user must choose from one of the suggestions. Also, the autosuggest list has no connection whatsoever with the user's personal Contacts folder or the Global Address List.

It sounds like you are more concerned about the autoresolution feature, in which Outlook resolves typed names against address lists set up in the mail profile and automatically resolves all SMTP addresses. By definition, autoresolution of names depends on the addresss lists present in the address book. Therefore, one solution for your scenario would be not a VSTO add-in, but an address book provider that exposes the database as an address list. Administrators could then lock down the mail profile to include only the Exchange server service and that address book provider, not the GAL and not the Outlook Address Book. (I'm not sure if the GAL can be excluded, however. That might be a good question for the microsoft.public.exchange.clients newsgroup. Perhaps it would require configuring clients for Cached Exchange mode but not generating an offline address book.) That, however, would not prevent Outlook from resolving all SMTP addresses.

Therefore, the best client solution probably would be an add-in to intercept the message after the user has clicked Send, raising the Application.ItemSend event. You can cancel that event and redisplay the message to the user if unauthorized addresses are included.

An alternative approach would be to use Exchange events to block the message at the server level.





Re: Visual Studio Tools for Office VSTO Outlook Addin Help

100011

The solution listed above does sound plausible, but what I would really like is a way to control the "Suggest names" feature and auto populate it with a list of addresses from a database. From other resources, I have found out that the Outlook.NK2 file stores the data for the "Suggest names" feature, but the file is in Unicode format and would be very time consuming to decrypt. I also noticed that the data from the file gets stored in memory and the file is updated when outlook closes so controlling that file wouldn't be much help.

I know a new visual studio is being developed (code name Orcas) and having a feature that can control the "Suggest names" feature would be helpful for the company I work for and most likely other companies as well. If you can help with ensuring that this suggestion gets to the people who make decisions about future functionality of visual studio that would be great.

Thanks





Re: Visual Studio Tools for Office VSTO Outlook Addin Help

Sue Mosher - Outlook MVP

Orcas is a platform. Like previous versions of Visual Studio, it will make no changes in the way Outlook itself operates or what techniques are exposed to programmers through the Outlook object model. Being able to control the nickname cache is not on the list of top features desired for Outlook extensibility among the developers I've talked to. It would pretty much require a complete overhaul of the autosuggest feature, and that doesn't seem likely.



Re: Visual Studio Tools for Office VSTO Outlook Addin Help

100011

I am a developer and work with lots of other developers; and if you were to ask us some of the best features you could offer to stay on the leading edge of providing functionality that is not available amongst other programming platforms and mail client software would be:

1.) Ability to control nickname cache in outlook

2.) Ability to create and add action panels to outlook (2003)





Re: Visual Studio Tools for Office VSTO Outlook Addin Help

Sue Mosher - Outlook MVP

FWIW, support for custom task panes has already been added in Outlook 2007. If you want to then in Outlook 2003, there's always the Add-in Express toolkit. Microsoft certainly isn't going to retrofit Outlook 2003 with CTPs.