我正在尝试使用我所有的手机联系人的生日来填充列表视图,但不幸的是,这似乎比我最初的想法更难 - 或者我错过了一些大事......
关于Windows Phone 8.1 Silverlight似乎是easy,因为有一个Birthday属性。但是如何在Windows Phone 8.1 Runtime中获得联系人的生日?
为什么没有房产?它可能很容易......
var contactStore = await ContactManager.RequestStoreAsync();
var contacts = await contactStore.FindContactsAsync();
foreach (var contact in contacts)
{
// var birthday = contact.Birthday; // unfortunately not possible
}
答案 0 :(得分:1)
This link这里终于指出了正确的方向:
var contactStore = await ContactManager.RequestStoreAsync();
var contacts = await contactStore.FindContactsAsync();
foreach (var contact in contacts)
{
// var list = contact.ImportantDates;
// Enumerating this list we can check for ContactDateKind == Birthday
// Or even shorter:
var birthday = contact.ImportantDates.FirstOrDefault(d => d.Kind == ContactDateKind.Birthday);
// birthday is null if there is no birthday saved for the current contact
}
答案 1 :(得分:0)
我认为你应该使用Microsoft Live Connect Api
。点击此链接http://developer.nokia.com/community/wiki/Birthday_Calendar_for_Windows_Phone
您还可以查看如何访问Windows Phone 8的日历数据? http://msdn.microsoft.com/en-us/library/windows/apps/hh286421%28v=vs.105%29.aspx
试试这个
var store = await ContactStore.CreateOrOpenAsync();
StoredContact sc = new StoredContact(store);
IDictionary<string, object> values = await sc.GetPropertiesAsync();
您可以在这里使用KnownContactProperties.Birthdate
。这可能会对你有所帮助。