如何在 Windows 10 UWP 中删除联系人,contact.DeleteAsync() 方法缺失

问题描述 投票:0回答:1

为什么 contact.DeleteAsync() 方法缺失/有错误?

private static async Task DoContactDelete()
        {
var contactStore = await ContactManager.RequestStoreAsync(ContactStoreAccessType.AllContactsReadOnly);
            var contacts = await contactStore.FindContactsAsync();
            
            foreach (var contact in contacts)
            {
var Text = contact.ToString();
// ONLY THIS ONE METHOD AVAILABLE, contact.DeleteAsync() METHOD IS MISSING

        await contact.DeleteAsync();
// Error   CS1061  'Contact' does not contain a definition for
 'DeleteAsync' and no accessible extension method 'DeleteAsync' 
//accepting a first argument of type 'Contact' could be found
(are you missing a using directive or an assembly reference ?
            }
        }

此行有错误: 等待 contact.DeleteAsync();

uwp windows-10-mobile
1个回答
0
投票

根据Contact Class的文档,没有可用的删除方法。您得到的行为是预期的。

© www.soinside.com 2019 - 2024. All rights reserved.