Last modified: July 23, 2011

Applies to: Outlook

Adds a service provider to the message service.

HRESULT CreateProvider(
  LPSTR lpszProvider,
  ULONG cValues,
  LPSPropValue lpProps,
  ULONG_PTR ulUIParam,
  ULONG ulFlags,


[in] A pointer to the name of the provider to add.


[in] The count of property values pointed to by the lpProps parameter.


[in] A pointer to a property value array that describes the properties of the provider to add.


[in] A handle to the parent window of any dialog boxes or windows this method displays. The ulUIParam parameter is used if the MAPI_DIALOG flag is set in the ulFlags parameter.


[in] A bitmask of flags that controls the provider addition. The following flags can be set:


Displays a dialog box to prompt for configuration information.


The provider name and string properties are in Unicode format. If the MAPI_UNICODE flag is not set, these strings are in ANSI format.


[out] A pointer to the MAPIUID structure that contains the unique identifier that represents the provider to add.


The provider was successfully added to the message service.


The user canceled the operation, typically by clicking the Cancel button in a dialog box.

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 whether the name matches the name of a provider in the service; if the passed name does not 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, the values in the ulUIParam and ulFlags parameters are also passed to the entry point function. These additional parameters enable the service provider to display its property sheet so the user can enter configuration settings.