locked
Displaying thumbnails using PickContactsAsync()

    Question

  • I have a Universal app that access the users contacts (I want to display their thumbnails). I want them to pick one or many contacts from their list, so I use

     var contactPicker = new Windows.ApplicationModel.Contacts.ContactPicker();

    contactPicker.DesiredFieldsWithContactFieldType.Add(ContactFieldType.Email);
                var onlineContacts = await contactPicker.PickContactsAsync();
                foreach (var contact in onlineContacts)
                {
                    if (contact.Thumbnail != null)
                    {
                        IRandomAccessStreamWithContentType stream = await contact.Thumbnail.OpenReadAsync();
                        if (stream != null && stream.Size > 0)
                        {
                        ////BitmapImage image = new BitmapImage();
                        ////image.SetSource(stream);
                        }
                    }
         }

    However, when I iterate through the list of onlineContacts, and hit IRandomAccessStreamWithContentType stream = await contact.Thumbnail.OpenReadAsync();, I get the error The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)

    How can I display the contacts thumbnail properly?

    Friday, January 30, 2015 2:02 PM

Answers

  • Works fine when running the app...not ideal, but I can;t be bothered looking at this anymore.
    Tuesday, February 10, 2015 11:46 AM

All replies

  • Hi,

    Please see the document:

    Quickstart: Selecting user contacts

    You codes seem to be right. I cannot reproduce the problem. And the exception is a COM error message,could be a installation issue or a timing issue, but I believe if you running the same code in another machine, should be ok.

    Please update the result after you test.

    Best Wishes!


    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. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.


    Monday, February 02, 2015 5:34 AM
  • Works fine when running the app...not ideal, but I can;t be bothered looking at this anymore.
    Tuesday, February 10, 2015 11:46 AM