SAMPLE: AdContac.exe Adds Sender of Incoming Message to Contacts

ID: Q198725


The information in this article applies to:


SUMMARY

AdContac.exe is a self-extracting archive that contains a custom rule extension sample written with Microsoft Visual C++ 5.0 for use with Microsoft Outlook 98.

AdContac is a custom action .dll file for use with the Rule Wizard in Outlook 98. When you are configuring the custom action, you are presented with a list of all of the Outlook Address Book enabled contacts folders in the current profile. You can select a contacts folder from any store. When a message that meets the conditions for your Inbox rule arrives, AdContac obtains the sender information from the message and creates a new entry in the Outlook Address Book (contacts) using Extended Messaging Application Programming Interface (MAPI).

If you want to create custom actions for use with the Rule Wizard in Outlook 98, then this sample will help you get started. It also gives you a working example of using the Exchange extension interfaces from Visual C++.


MORE INFORMATION

The following file is available for download from the Microsoft Software Library:
~ AdContac.exe - 152KB archive containing 13 files totaling 336KB.

Release Date: 2/15/99

For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:

Q119591 How to Obtain Microsoft Support Files from Online Services



   FileName          Size     Description
   ---------------------------------------------------------
   AdContac.dll     227KB     Custom Action extension DLL
   AdContac.reg       1KB     Custom Action registration file
   AdContac.cpp      26KB     main extension source file
   AdContac.h         5KB     main extension header file
   AdContac.def       1KB     extension definition file
   crarun.dsp         5KB     Microsoft Visual C++ 5.0 project file
   crarun.dsw         1KB     Microsoft Visual C++ 5.0 workspace file
   msoutl85.cpp      55KB     Outlook Object Model Import source file
   msoutl85.h        14KB     Outlook Object Model Import header file
   resource.h         1KB     extension resource header file
   script1.rc         3KB     extension resource template
   stdafx.cpp         1KB     preprocessor source file
   stdafx.h           2KB     preprocessor header file 


Installing and Configuring the Sample

  1. Copy AdContac.dll to your \Windows\System directory. Winnt\System32 is used by this sample.


  2. Open the AdContac.reg file in Notepad and change the path to reflect the actual location of the AdContac.dll on your system.


  3. Save the AdContac.Reg file and exit Notepad.


  4. Double-click the AdContac.reg file in Windows Explorer. This will register the AdContac.dll for use by Outlook as a custom action.


  5. Switch to or start Microsoft Outlook and select the Rules Wizard from the Tools menu.


  6. Select New to add a new rule to Outlook.


  7. Select the "Check Messages when they arrive" option and click Next.


  8. Select the desired option and enter the condition you want to the rule to respond to.


  9. Click Next after you have entered a condition that will trap a message.


  10. Select the Perform a Custom Action option.


  11. Click on "a custom action" in the description box and select AddSenderToContacts from the drop-down list.


  12. Click Change and select a contacts folder from the list. The name of the selected contacts folder should be filled in the Action Value text box.

    NOTE: If your contact folder is not on the list then perform the following steps:

    1. Cancel the rule setup and return to the Outlook Explorer shell.


    2. Right-click on your contacts folder and select properties from the context menu.


    3. Select the Outlook Address Book tab in the Properties dialog box.


    4. Select the "Show this folder as an e-mail address book" option.




  13. Click Next and select any exceptions you want to apply to this rule.


  14. Click Next and enter a name for this rule.


  15. Make sure that the "Turn on this Rule" box is selected.


  16. Verify that all of the settings are correct and click Finish.



Test the rule by sending yourself a message that meets the rules conditions. The sender of the message should be added to the selected contacts folder.

You can use the included Microsoft Visual C++ 5.0 project and source code as a template for other custom actions.

Additional query words: kbDSupport extension rule Custom Action Outlook kbMsg kbVC kbOutlook98 kbMAPI kbfile


Keywords          : kbfile kbEDK kbMAPI kbMsg kbOutlook98 kbOutlookObj kbVC 
Version           : WINDOWS:5.0,5.5
Platform          : WINDOWS 
Issue type        : kbhowto 

Last Reviewed: February 26, 1999