none
[wp8.1][c#] ContactPicker limitation ? any workaround ? RRS feed

  • Question

  • Hi,

    working one some app and need to let user pick a contact from contact list.
    trying to use ContactPicker but hit a wall.

    it will not work if you don't set one and only one DesiredFieldsWithContactFieldType

    but (it seems to me) if you set it to say Phonenumber, it will filters out all contacts w/o phones. so, in general, you can't pick contact that has no phone, no email and no address  with contactPicker.

    also, if you set desiredfields to phonenumber you will not see and can't pick contacts without phones but with emails ?

    so, before I'll start to write homemade contactpicker I decide to ask community .. am I right with the above limitation and I need my own contact picker or I just missed smth ?

    tia

    Thursday, September 3, 2015 12:43 PM

Answers

All replies

  • Hello tia,

    >>it will not work if you don't set one and only one DesiredFieldsWithContactFieldType

    When checked this sample: https://code.msdn.microsoft.com/windowsapps/Contact-Picker-App-sample-fc6677a1  You can see it just used the email as the DesiredFieldsWithContactFieldType. So may we know your code here about this?

    >>you can't pick contact that has no phone, no email and no address with contactPicker

    Do you mean this is just a contact people with none of the above info?

    Based on the enumeration,Only the PhoneNumber, Email, and Address values are supported on Windows Phone. So I think you are right with the above. They are the only supported values above.

    Best regards,

    Barry

     


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, September 4, 2015 11:02 AM
    Moderator
  • Barry,

    the code is very simple and straightforward

    Contact c = null;
                try
                {
                    var cPicker = new ContactPicker();
    
                    cPicker.DesiredFieldsWithContactFieldType.Add(Windows.ApplicationModel.Contacts.ContactFieldType.PhoneNumber);
                    
                    
                    c = await cPicker.PickContactAsync();
    

    ....the problem is not in my code I think. the problem or the question is ,

    am I right, that

     in WP 8.1 environment current version of contact picker will not allow you to choose contact which doesn't have either email or phone or address . it will just now show you such contacts

    I mean that let's say you have 4 contacts in contact list

    contact 1 with phone (email and address = blank)

    contact 2 with email (phone and address = blank)

    contact 3 with address (email and phone = blank)

    contact 4 with all the above fields blank

    with current contact picker you have now way to choose contact 4

    depending on the DesiredFieldsWithContactFieldType value contactpicker will show you only one contact (from the above list ) which has corresponding (to DesiredFieldsWithContactFieldType value) field not empty

    and there is no workaround except of writing your own contact picker

    am I right ?

    thanks in advance ( = tia :)

    ish


    • Edited by ish1313 Friday, September 4, 2015 12:00 PM
    Friday, September 4, 2015 11:59 AM
  • @ish,

    Yep I suspect based on the contactpicker it will only support the above things when searching. No other ways are supported since I saw this page https://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.contacts.contactpicker.pickcontactasync

    Note  For Windows Phone Store apps, you must add a DesiredFieldsWithContactFieldType set to one of three ContactFieldType values, either Address, Email or PhoneNumber. Otherwise, you will receive a runtime exception

    If you want to do the above you may have to implement your own  contact picker.

    Best regards,

    Barry


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by ish1313 Friday, September 11, 2015 4:58 AM
    Friday, September 11, 2015 1:17 AM
    Moderator
  • strange limitation to not allow to work with full contact list ;) but..

    thanks. don't want to rewrite it due to missing smth in the docs

    Friday, September 11, 2015 4:58 AM