PhoneLine.FromIdAsync(Guid) Method

Definition

This static method asynchronously retrieves a PhoneLine object that represents a specific phone line on the device based on the line ID.

public:
 static IAsyncOperation<PhoneLine ^> ^ FromIdAsync(Platform::Guid lineId);
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<PhoneLine> FromIdAsync(winrt::guid const& lineId);
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<PhoneLine> FromIdAsync(Guid lineId);
function fromIdAsync(lineId)
Public Shared Function FromIdAsync (lineId As Guid) As IAsyncOperation(Of PhoneLine)

Parameters

lineId
Guid

Platform::Guid

winrt::guid

The line ID of the phone line to retrieve.

Returns

An asynchronous operation that returns a PhoneLine object that represents a specific phone line on the device based on the line ID. It will throw an exception on failure.

Attributes

Windows requirements

App capabilities
phoneCallHistory phoneCallHistorySystem

Remarks

The following example shows how to get the default PhoneLine.

private async Task<PhoneLine> GetDefaultPhoneLineAsync()
{
    PhoneCallStore phoneCallStore = await PhoneCallManager.RequestStoreAsync();
    Guid lineId = await phoneCallStore.GetDefaultLineAsync();
    PhoneLine line = null;
    try
    {
        line = await PhoneLine.FromIdAsync(lineId);
    }
    catch (Exception ex)
    {
        Logger.Instance.LogErrorMessage($"PhoneLine.FromIdAsync failed:{ex.Message}");
    }
return line;
}

Applies to