Delen via


ConnectionProfile Class

Definition

Represents a network connection, which includes either the currently connected network or prior network connections. Provides information about the connection status and connectivity statistics.

public ref class ConnectionProfile sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class ConnectionProfile final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class ConnectionProfile
Public NotInheritable Class ConnectionProfile
Inheritance
Object Platform::Object IInspectable ConnectionProfile
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Remarks

The following example function demonstrates how to retrieve data from a ConnectionProfile.

function getConnectionProfileInfo(connectionProfile) {

     returnString += "Connection Cost Information:\n\r";
     returnString += "===============\n\r";
     var connectionCost = connectionProfile.getConnectionCost();
     returnString += "Cost Type: " + getCostType(connectionCost.networkCostType) + "\n\r";
     returnString += "Roaming: " + connectionCost.roaming + "\n\r";
     returnString += "Over Datalimit: " + connectionCost.overDataLimit + "\n\r";
     returnString += "Approaching Datalimit: " + connectionCost.approachingDataLimit + "\n\r";
}

For more examples of how these class methods are implemented to access connection information, see Quickstart: Retrieving network connection information.

Version history

Windows version SDK version Value added
1709 16299 GetProviderNetworkUsageAsync
1809 17763 CanDelete
1809 17763 TryDeleteAsync

Properties

CanDelete

Gets a value that indicates whether or not it is possible to delete this connection profile. This can help determine whether TryDeleteAsync is likely to succeed.

IsWlanConnectionProfile

Gets a value that indicates if connection profile is a WLAN (WiFi) connection. This determines whether or not WlanConnectionProfileDetails is null.

IsWwanConnectionProfile

Gets a value that indicates if connection profile is a WWAN (mobile) connection. This determines whether or not WwanConnectionProfileDetails is null.

NetworkAdapter

Gets the object representing the network adapter providing connectivity for the connection.

NetworkSecuritySettings

Retrieves the security settings for the network.

ProfileName

Gets the name of the connection profile.

ServiceProviderGuid

Gets the ID of the network operator who provisioned the connection profile.

WlanConnectionProfileDetails

Gets a WlanConnectionProfileDetails object that provides a method for retrieving information specific to a WLAN (WiFi) connection.

WwanConnectionProfileDetails

Gets a WwanConnectionProfileDetails object containing the properties and methods used to retrieve information specific to mobile broadband connections.

Methods

GetAttributedNetworkUsageAsync(DateTime, DateTime, NetworkUsageStates)

Gets network usage data for each individual application.

GetConnectionCost()

Gets the cost information for the connection.

GetConnectivityIntervalsAsync(DateTime, DateTime, NetworkUsageStates)

Gets a list of ConnectivityInterval objects, which indicate the timestamp for when the network connection began, and a time-span for the duration of that connection.

GetDataPlanStatus()

Gets the current status of the data plan associated with the connection.

GetDomainConnectivityLevel()

Gets the current domain authentication status for a network connection. Possible values are defined by DomainConnectivityLevel.

GetLocalUsage(DateTime, DateTime, RoamingStates)

Note

GetLocalUsage may be altered or unavailable for releases after Windows 8.1. Instead, use GetNetworkUsageAsync

Gets the estimated data usage for a connection over a specific period of time and roaming state.

GetLocalUsage(DateTime, DateTime)

Note

GetLocalUsage may be altered or unavailable for releases after Windows 8.1. Instead, use GetNetworkUsageAsync

Gets the estimated data usage for a connection during over a specific period of time.

GetNetworkConnectivityLevel()

Gets the network connectivity level for this connection. This value indicates what network resources, if any, are currently available.

GetNetworkNames()

Retrieves names associated with the network with which the connection is currently established.

GetNetworkUsageAsync(DateTime, DateTime, DataUsageGranularity, NetworkUsageStates)

Gets a list of the estimated data traffic and connection duration over a specified period of time, for a specific network usage state.

DataUsageGranularity is used to indicate the desired granularity of the returned data and affects the length of the returned list. NetworkUsageStates is used to indicate the desired network usage configuration.

GetProviderNetworkUsageAsync(DateTime, DateTime, NetworkUsageStates)

Returns the bytes sent and bytes received for each MCC and MNC combination (the combination is represented by a ProviderId).

GetSignalBars()

Gets a value that indicates the current number of signal bars displayed by the Windows UI for the connection.

IsDomainAuthenticatedBy(DomainAuthenticationKind)

Queries whether the specified domain authentication method succeeded for this connection profile.

TryDeleteAsync()

Asynchronously attempts to delete this connection profile; the operation may or may not succeed. Examine the return value to determine the outcome of the operation.

Applies to

See also