IProviderAdmin::CreateProvider

Applies to: Outlook 2013 | Outlook 2016

Adds a service provider to the message service.

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

Parameters

lpszProvider

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

cValues

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

lpProps

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

ulUIParam

[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.

ulFlags

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

  • MAPI_DIALOG: Displays 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] A pointer to the MAPIUID structure that contains the unique identifier that represents the provider to add.

Return value

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 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.

See also