IProviderAdmin::CreateProvider

The IProviderAdmin::CreateProvider method adds a service provider to the message service.

Quick Info

See IProviderAdmin : IUnknown.

HRESULT CreateProvider(
  LPTSTR lpszProvider,   
  ULONG cValues,         
  LPSPropValue lpProps,  
  ULONG ulUIParam,       
  ULONG ulFlags,         
  MAPIUID FAR * lpUID    
);
 

Parameters

lpszProvider
[in] Pointer to the name of the provider to add.
cValues
[in] Count of property values pointed to by the lpProps parameter.
lpProps
[in] Pointer to an property value array describing the properties of the provider to add.
ulUIParam
[in] Handle of the parent window for any dialog boxes or windows this method displays. The ulUIParam parameter is used if the MAPI_DIALOG flag is set in the ulFlags parameter.
ulFlags
[in] Bitmask of flags that controls the provider addition. The following flags can be set:
MAPI_DIALOG
Allows the display of a dialog box to prompt for configuration information.
MAPI_UNICODE
The provider name and string properties are in Unicode format. If the MAPI_UNICODE flag is not set, these strings are in ANSI format.
lpUID
[out] Pointer to the MAPIUID structure holding the unique identifier representing the provider to add.

Return Values

S_OK
The provider was successfully added to the message service.
MAPI_E_USER_CANCEL
The user canceled the operation, typically by clicking the Cancel button in a dialog box.

Remarks

The IProviderAdmin::CreateProvider method adds a service provider to the message service. The lpszProvider parameter must point to the name of a provider that belongs to the message service. CreateProvider does not verify that the name matches the name of a provider in the service; if the passed name doesn't match a service name, the call succeeds, but the results are unpredictable. Most message services do not allow providers to be added or deleted while the profile is in use.

After all of the available information about the service provider has been added to the profile from the MAPISVC.INF file, CreateProvider calls the message service's entry point function with the ulContext parameter set to MSG_SERVICE_PROVIDER_CREATE. If MAPI_DIALOG is set in the CreateProvider method's ulFlags parameter, then the values in the ulUIParam and ulFlags parameters are also passed to the entry point function. These additional parameters allow the service provider to display its property sheet so that the user can enter configuration settings.

See Also

MAPIUID, MSGSERVICEENTRY, SPropValue