共用方式為


PhoneLine.FromIdAsync(Guid) 方法

定義

這個靜態方法會以異步方式擷取 PhoneLine 物件,此物件會根據線路標識碼,代表裝置上的特定電話線路。

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)

參數

lineId
Guid

Platform::Guid

winrt::guid

要擷取之電話線路的行標識碼。

傳回

異步操作,會傳回 PhoneLine 物件,此物件代表根據線路標識碼在裝置上的特定電話線路。 它會在失敗時擲回例外狀況。

屬性

Windows 需求

應用程式功能
phoneCallHistory phoneCallHistorySystem

備註

下列範例示範如何取得預設 的 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;
}

適用於