This code snippet is for Get user picture using Lync (Skype for business) SDK APIs.
public class UserEntity
{
public BitmapImage UserImage { get; set; }
}
public partial class MainPage : UserControl
{
List<UserEntity> allUsers = new List<UserEntity>();
LyncClient client;
public MainPage()
{
InitializeComponent();
client = LyncClient.GetClient();
UserEntity userObjet = new UserEntity();
if (client != null)
{
ContactManager cManager = client.ContactManager;
if (cManager != null)
{
Contact contact = cManager.GetContactByUri("[email protected]");
if (contact != null)
{
List<ContactInformationType> ciList = new List<ContactInformationType>();
ciList.Add(ContactInformationType.Photo);
IDictionary<ContactInformationType, object> dic = null;
dic = contact.GetContactInformation(ciList);
if (dic != null)
{
Stream photoStream = dic[ContactInformationType.Photo] as Stream;
if (photoStream != null)
{
BitmapImage userImageBitMap = new BitmapImage();
userImageBitMap.SetSource(photoStream);
userObjet.UserImage = userImageBitMap;
}
}
}
}
}
allUsers.Add(userObjet);
if (allUsers != null && allUsers.Count > 0)
{
userImage.ItemsSource = allUsers;
}
}
<Image Name="userImage" Source="{Binding Path=UserImage}" Margin="2,2,2,2" Height="40" Width="40"></Image>