WiFiAdapter WiFiAdapter WiFiAdapter WiFiAdapter Class

Definition

Some information relates to pre-released product which may be substantially modified before it’s commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Prerelease APIs are identified by a Prerelease label.

[Contains prerelease APIs.]
Use this class to enumerate local Wi-Fi adapters, initiate Wi-Fi scans, enumerate scan results, and to connect or disconnect individual adapters.

public : sealed class WiFiAdapter : IWiFiAdapterpublic sealed class WiFiAdapter : IWiFiAdapterPublic NotInheritable Class WiFiAdapter Implements IWiFiAdapter// You can use this class in JavaScript.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

Your code uses the static methods of this class.

Properties

NetworkAdapter NetworkAdapter NetworkAdapter NetworkAdapter

Gets information about a Wi-Fi adapter.

public : NetworkAdapter NetworkAdapter { get; }public NetworkAdapter NetworkAdapter { get; }Public ReadOnly Property NetworkAdapter As NetworkAdapter// You can use this property in JavaScript.

NetworkReport NetworkReport NetworkReport NetworkReport

Gets a list of available networks populated by the last Wi-Fi scan on this WiFiNetworkAdapter.

public : WiFiNetworkReport NetworkReport { get; }public WiFiNetworkReport NetworkReport { get; }Public ReadOnly Property NetworkReport As WiFiNetworkReport// You can use this property in JavaScript.

Methods

ConnectAsync(WiFiAvailableNetwork, WiFiReconnectionKind) ConnectAsync(WiFiAvailableNetwork, WiFiReconnectionKind) ConnectAsync(WiFiAvailableNetwork, WiFiReconnectionKind) ConnectAsync(WiFiAvailableNetwork, WiFiReconnectionKind)

Connect this Wi-Fi device to the specified network, with the specified reconnection policy.

public : IAsyncOperation<WiFiConnectionResult> ConnectAsync(WiFiAvailableNetwork availableNetwork, WiFiReconnectionKind reconnectionKind)public IAsyncOperation<WiFiConnectionResult> ConnectAsync(WiFiAvailableNetwork availableNetwork, WiFiReconnectionKind reconnectionKind)Public Function ConnectAsync(availableNetwork As WiFiAvailableNetwork, reconnectionKind As WiFiReconnectionKind) As IAsyncOperation( Of WiFiConnectionResult )// You can use this method in JavaScript.
Parameters
availableNetwork
WiFiAvailableNetwork WiFiAvailableNetwork WiFiAvailableNetwork WiFiAvailableNetwork

Describes the Wi-Fi network to be connected.

reconnectionKind
WiFiReconnectionKind WiFiReconnectionKind WiFiReconnectionKind WiFiReconnectionKind

Specifies how to reconnect if the connection is lost.

Returns

An asynchronous connect operation. On successful conclusion of the operation, returns an object that describes the result of the connect operation.

See Also

ConnectAsync(WiFiAvailableNetwork, WiFiReconnectionKind, PasswordCredential) ConnectAsync(WiFiAvailableNetwork, WiFiReconnectionKind, PasswordCredential) ConnectAsync(WiFiAvailableNetwork, WiFiReconnectionKind, PasswordCredential) ConnectAsync(WiFiAvailableNetwork, WiFiReconnectionKind, PasswordCredential)

Connect this Wi-Fi device to the specified network, with the specified passphrase and reconnection policy.

public : IAsyncOperation<WiFiConnectionResult> ConnectAsync(WiFiAvailableNetwork availableNetwork, WiFiReconnectionKind reconnectionKind, PasswordCredential passwordCredential)public IAsyncOperation<WiFiConnectionResult> ConnectAsync(WiFiAvailableNetwork availableNetwork, WiFiReconnectionKind reconnectionKind, PasswordCredential passwordCredential)Public Function ConnectAsync(availableNetwork As WiFiAvailableNetwork, reconnectionKind As WiFiReconnectionKind, passwordCredential As PasswordCredential) As IAsyncOperation( Of WiFiConnectionResult )// You can use this method in JavaScript.
Parameters
availableNetwork
WiFiAvailableNetwork WiFiAvailableNetwork WiFiAvailableNetwork WiFiAvailableNetwork

Specifies the Wi-Fi network to connect to.

reconnectionKind
WiFiReconnectionKind WiFiReconnectionKind WiFiReconnectionKind WiFiReconnectionKind

Describes how to reconnect to the network if connection is lost.

passwordCredential
PasswordCredential PasswordCredential PasswordCredential PasswordCredential

The passphrase to be used to connect to the access point.

Returns

An asynchronous connect operation. On successful conclusion of the operation, returns an object that describes the result of the connect operation.

See Also

ConnectAsync(WiFiAvailableNetwork, WiFiReconnectionKind, PasswordCredential, String) ConnectAsync(WiFiAvailableNetwork, WiFiReconnectionKind, PasswordCredential, String) ConnectAsync(WiFiAvailableNetwork, WiFiReconnectionKind, PasswordCredential, String) ConnectAsync(WiFiAvailableNetwork, WiFiReconnectionKind, PasswordCredential, String)

Connect this Wi-Fi device to a hidden network, with the given passphrase and reconnection policy.

public : IAsyncOperation<WiFiConnectionResult> ConnectAsync(WiFiAvailableNetwork availableNetwork, WiFiReconnectionKind reconnectionKind, PasswordCredential passwordCredential, PlatForm::String ssid)public IAsyncOperation<WiFiConnectionResult> ConnectAsync(WiFiAvailableNetwork availableNetwork, WiFiReconnectionKind reconnectionKind, PasswordCredential passwordCredential, String ssid)Public Function ConnectAsync(availableNetwork As WiFiAvailableNetwork, reconnectionKind As WiFiReconnectionKind, passwordCredential As PasswordCredential, ssid As String) As IAsyncOperation( Of WiFiConnectionResult )// You can use this method in JavaScript.
Parameters
availableNetwork
WiFiAvailableNetwork WiFiAvailableNetwork WiFiAvailableNetwork WiFiAvailableNetwork

Describes the Wi-Fi network to connect to.

reconnectionKind
WiFiReconnectionKind WiFiReconnectionKind WiFiReconnectionKind WiFiReconnectionKind

Describes how to reconnect to the network if connection is lost.

passwordCredential
PasswordCredential PasswordCredential PasswordCredential PasswordCredential

Password or other credential to use to connect to the network.

ssid
PlatForm::String String String String

When the network SSID is hidden, use this parameter to provide the SSID.

Returns

An asynchronous connect operation. On successful conclusion of the operation, returns an object that describes the result of the connect operation.

See Also

ConnectAsync(WiFiAvailableNetwork, WiFiReconnectionKind, PasswordCredential, String, WiFiConnectionMethod) ConnectAsync(WiFiAvailableNetwork, WiFiReconnectionKind, PasswordCredential, String, WiFiConnectionMethod) ConnectAsync(WiFiAvailableNetwork, WiFiReconnectionKind, PasswordCredential, String, WiFiConnectionMethod) ConnectAsync(WiFiAvailableNetwork, WiFiReconnectionKind, PasswordCredential, String, WiFiConnectionMethod)

Prerelease. Connect this Wi-Fi device to a hidden network, with the given passphrase, connection method, and reconnection policy.

public : IAsyncOperation<WiFiConnectionResult> ConnectAsync(WiFiAvailableNetwork availableNetwork, WiFiReconnectionKind reconnectionKind, PasswordCredential passwordCredential, PlatForm::String ssid, WiFiConnectionMethod connectionMethod)public IAsyncOperation<WiFiConnectionResult> ConnectAsync(WiFiAvailableNetwork availableNetwork, WiFiReconnectionKind reconnectionKind, PasswordCredential passwordCredential, String ssid, WiFiConnectionMethod connectionMethod)Public Function ConnectAsync(availableNetwork As WiFiAvailableNetwork, reconnectionKind As WiFiReconnectionKind, passwordCredential As PasswordCredential, ssid As String, connectionMethod As WiFiConnectionMethod) As IAsyncOperation( Of WiFiConnectionResult )// You can use this method in JavaScript.
Parameters
availableNetwork
WiFiAvailableNetwork WiFiAvailableNetwork WiFiAvailableNetwork WiFiAvailableNetwork

Specifies the Wi-Fi network to connect to.

reconnectionKind
WiFiReconnectionKind WiFiReconnectionKind WiFiReconnectionKind WiFiReconnectionKind

Specifies how to reconnect if the connection is lost.

passwordCredential
PasswordCredential PasswordCredential PasswordCredential PasswordCredential

The passphrase to be used to connect to the access point.

ssid
PlatForm::String String String String

When the network SSID is hidden, use this parameter to provide the SSID.

connectionMethod
WiFiConnectionMethod WiFiConnectionMethod WiFiConnectionMethod WiFiConnectionMethod

A WiFiConnectionMethod enumeration member indicating the connection method.

Returns

An asynchronous connect operation. On successful conclusion of the operation, returns an object that describes the result of the connect operation.

Additional features and requirements
Device family
Windows 10 Insider Preview (introduced v10.0.16257.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)
See Also

Disconnect() Disconnect() Disconnect() Disconnect()

Disconnects any active Wi-Fi connection through this adapter.

public : void Disconnect()public void Disconnect()Public Function Disconnect() As void// You can use this method in JavaScript.

FindAllAdaptersAsync() FindAllAdaptersAsync() FindAllAdaptersAsync() FindAllAdaptersAsync()

A static method that initiates an asynchronous operation to enumerate all Wi-Fi adapters in the system.

Note that if you do not specify that your app has the wiFiControl capability in your app manifest, this method fails.

public : static IAsyncOperation<IVectorView<WiFiAdapter>> FindAllAdaptersAsync()public static IAsyncOperation<IReadOnlyList<WiFiAdapter>> FindAllAdaptersAsync()Public Static Function FindAllAdaptersAsync() As IAsyncOperation( Of IReadOnlyListWiFiAdapter )// You can use this method in JavaScript.
Returns
IAsyncOperation<IVectorView<WiFiAdapter>> IAsyncOperation<IReadOnlyList<WiFiAdapter>> IAsyncOperation<IReadOnlyList<WiFiAdapter>> IAsyncOperation<IReadOnlyList<WiFiAdapter>>

An asynchronous enumeration operation. On successful completion, returns a list of available Wi-Fi adapters.

If you do not specify that your app has the wiFiControl capability in your app manifest, this method fails.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
wiFiControl

FromIdAsync(String) FromIdAsync(String) FromIdAsync(String) FromIdAsync(String)

A static method that initiates an asynchronous operation to get a WiFiAdapter object.

Note that if you do not specify that your app has the wiFiControl capability in your app manifest, this method fails.

public : static IAsyncOperation<WiFiAdapter> FromIdAsync(PlatForm::String deviceId)public static IAsyncOperation<WiFiAdapter> FromIdAsync(String deviceId)Public Static Function FromIdAsync(deviceId As String) As IAsyncOperation( Of WiFiAdapter )// You can use this method in JavaScript.
Parameters
deviceId
PlatForm::String String String String

The Device ID of the Wi-Fi adapter to be retrieved. Obtain a Device ID through the Windows.Devices.Enumeration namespace.

Returns

An asynchronous get operation. On successful completion, returns a WiFiAdapter object specific to the requested Device ID.

If you do not specify that your app has the wiFiControl capability in your app manifest, this method fails.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
wiFiControl

GetDeviceSelector() GetDeviceSelector() GetDeviceSelector() GetDeviceSelector()

A static method that returns an Advanced Query Syntax (AQS) string to be used to enumerate Wi-Fi adapters using Windows.Devices.Enumeration.DeviceInformation.FindAllAsync and related methods.

public : static PlatForm::String GetDeviceSelector()public static string GetDeviceSelector()Public Static Function GetDeviceSelector() As string// You can use this method in JavaScript.
Returns
PlatForm::String string string string

An identifier to be used to enumerate Wi-Fi devices.

GetWpsConfigurationAsync(WiFiAvailableNetwork) GetWpsConfigurationAsync(WiFiAvailableNetwork) GetWpsConfigurationAsync(WiFiAvailableNetwork) GetWpsConfigurationAsync(WiFiAvailableNetwork)

Prerelease. Performs WPS discovery to query the WPS methods supported by the network.

public : IAsyncOperation<WiFiWpsConfigurationResult> GetWpsConfigurationAsync(WiFiAvailableNetwork availableNetwork)public IAsyncOperation<WiFiWpsConfigurationResult> GetWpsConfigurationAsync(WiFiAvailableNetwork availableNetwork)Public Function GetWpsConfigurationAsync(availableNetwork As WiFiAvailableNetwork) As IAsyncOperation( Of WiFiWpsConfigurationResult )// You can use this method in JavaScript.
Parameters
availableNetwork
WiFiAvailableNetwork WiFiAvailableNetwork WiFiAvailableNetwork WiFiAvailableNetwork

An available Wi-Fi network. See WiFiAvailableNetwork class.

Returns
Additional features and requirements
Device family
Windows 10 Insider Preview (introduced v10.0.16257.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)
See Also

RequestAccessAsync() RequestAccessAsync() RequestAccessAsync() RequestAccessAsync()

A static method for determining whether the current user can access any of the Wi-Fi adapters on this device.

Note that if you do not specify that your app has the wiFiControl capability in your app manifest, this method always returns DeniedBySystem.

Always returns DeniedBySystem on Xbox.

public : static IAsyncOperation<WiFiAccessStatus> RequestAccessAsync()public static IAsyncOperation<WiFiAccessStatus> RequestAccessAsync()Public Static Function RequestAccessAsync() As IAsyncOperation( Of WiFiAccessStatus )// You can use this method in JavaScript.
Returns

An asynchronous access operation. On successful completion, returns a status enumeration value describing whether the current user can access any Wi-Fi adapter.

Note that if you do not specify that your app has the wiFiControl capability in your app manifest, this method always returns DeniedBySystem.

Always returns DeniedBySystem on Xbox.

ScanAsync() ScanAsync() ScanAsync() ScanAsync()

Directs this adapter to initiate an asynchronous network scan.

public : IAsyncAction ScanAsync()public IAsyncAction ScanAsync()Public Function ScanAsync() As IAsyncAction// You can use this method in JavaScript.
Returns

An asynchronous scan operation. On successful completion, returns a list of networks scanned by this adapter.

Remarks

You should call this API from a foreground app. If it is called from a background task, you will see an "Access Denied" error message or a similar message.

Events

AvailableNetworksChanged AvailableNetworksChanged AvailableNetworksChanged AvailableNetworksChanged

Event raised when a scan completes on this Wi-Fi adapter. This event cannot be raised from a background task.

public : event TypedEventHandler AvailableNetworksChanged<WiFiAdapter,  object>public event TypedEventHandler AvailableNetworksChanged<WiFiAdapter,  object>Public Event AvailableNetworksChanged<WiFiAdapter,  object>// You can use this event in JavaScript.