Starting in Windows 10, version 1803, the Win32 APIs described in this section are replaced by the Windows Runtime APIs in the Windows.Networking.Connectivity namespace.
Gets the list of preferred providers.
HRESULT GetPreferredProviders( SAFEARRAY **preferredProviders );
Pointer to an array of MBN_PROVIDER structures that contains the list of preferred providers. If this method returns any value other than S_OK, this parameter is NULL. When GetPreferredProviders returns S_OK, the calling application must free the allocated memory by calling SafeArrayDestroy.
This method can return one of these values.
||The method completed successfully. preferredProviders contains valid values.|
||The information is not available. The Mobile Broadband service is currently probing for the list of preferred providers. The calling application can get notified when the data is available by registering for the OnPreferredProvidersChange method of IMbnInterfaceEvents.|
||The device requires that a PIN must be entered for this operation.|
||The SIM is not inserted.|
||A bad SIM is inserted in the device.|
||Unable to read from the SIM or device memory. For example, the SIM does not have preferred provider information provisioned.|
||The device does not support this operation. CDMA devices will always return this value.|
GetPreferredProviders returns the list of providers that are stored in the interface's preferred provider list.
For the recoverable errors E_MBN_PIN_REQUIRED, E_MBN_SIM_NOT_INSERTED, and E_MBN_BAD_SIM, the Mobile Broadband service will query the device again for the provider list when the error condition is over. For example, if the device requires a PIN to be entered to get the provider list, then GetPreferredProviders will return E_MBN_PIN_REQUIRED. When an application enters a PIN to unlock the device, then the Mobile Broadband service will again try to get this information from the device.
When the operating system is querying the device to get the provider list after a recoverable error has occurred, GetPreferredProviders immediately returns E_PENDING. Once the new query has completed, a notification is sent to the calling application using the appropriate callback method. For example, after a successful PIN unlock operation, the OnEnterComplete method of IMbnPinEvents would be called. After recovering from a SIM card error, the OnReadyStateChange method of IMbnInterfaceEvents would be called.
In some cases, the device's preferred provider list can be updated through the network by SMS or OTA (over-the-air update). The operating system will notify the application of any change in the preferred provider list by calling the OnPreferredProvidersChange method of IMbnInterfaceEvents.
|Minimum supported client||Windows 7 [desktop apps | UWP apps]|
|Minimum supported server||None supported|