Platform SDK: CDO for Windows 2000

http://schemas.microsoft.com/cdo/configuration/ Namespace

The http://schemas.microsoft.com/cdo/configuration/ namespace defines the majority of fields used to set configurations for various CDO objects. These configuration fields are set using an implementation of the IConfiguration.Fields collection.

Many CDO objects use information stored in an associated Configuration object to define configuration settings. One example is the Message object, where you use its associated Configuration object to set fields such as sendusing. This field defines whether to send the message using the local SMTP service drop directory (if the local machine has the SMTP service installed), an SMTP service directly over the network. If sending over the network, you set smtpservername to specify the IP address or DNS name of the machine hosting the SMTP service, and optionally, smtpserverport to specify a port value. If credentials are required for connecting to an SMTP service, you can specify them by setting the sendusername and sendpassword.

A similar set of fields exists for posting messages using either a local NNTP service pickup directory, or over the network.

All of the names listed below are also defined as string constants in the type library and IDL file for convenience.

Default Configuration Values

In many cases, you may not wish to explicitly set the configuration for a particular object. The CDO component provides default values for the fields that depend on the software installed on the system.

Outlook Express Settings

With Outlook Express installed on the system, various fields default to the settings associated with the default Outlook Express mail account for the default identity. The possible fields are numerous and not listed here. Check the associated field below for the associated Outlook Express value used as a default.

Both Outlook Express and SMTP/NNTP Service

In the case where both Outlook Express and SMTP/NNTP services exist on the same machine, both default settings are loaded. The sendusing and postusing fields, however, each default to 1, meaning to use the associated pickup directories for the installed services, if that service is installed.

Example

[Visual Basic]
Dim iConfig as new CDO.Configuration 
Dim Flds as ADODB.Fields
iConfig.Load cdoSourceIIS

Set Flds = iConfig.Fields
With Flds
  ' Its good practice to use the module constants defined in the 
  ' type library for the names.  The full names are used here to
  ' indicate that this is what is going on
  .Item("http://schemas.microsoft.com/cdo/configuration/smtperver")      = "mail.microsoft.com "
  .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
  .Item("http://schemas.microsoft.com/cdo/configuration/sendusing")  = CdoSendUsingPort
  .Update
End With
[C++,IDL]
#import "c:\program files\common files\system\ado\msado15.dll" no_namespace
#import <cdosys.dll> no_namespace
#include <cdosysstr.h>  // string constants in this file
  CoInitialize(NULL);
  {
    IConfigurationPtr iConf(__uuidof(Configuration));
    FieldsPtr iFields;

    iConf->Load(cdoSourceIIS);  // this string constant from import
    Flds = iConf->Fields;

    Flds->Item["http://schemas.microsoft.com/cdo/configuration/smtperver"]->Value      
    = _variant_t("mailserver");
    Flds->Item["http://schemas.microsoft.com/cdo/configuration/smtpserverport"]->Value 
    = _variant_t((long)25);
    Flds->Item["http://schemas.microsoft.com/cdo/configuration/sendusing"]->Value 
    = _variant_t((long)cdoSendUsingPort);
    Flds->Update();
    // ...
  }
   CoUninitialize();
}