Live Webinar: Prompt Engineering: Skill Everyone Must Learn Today
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Get User Picture using Lync (Skye for Business) SDK
WhatsApp
Bhushan Gawale
Apr 26
2016
2
k
0
0
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
>
Skype
Picture
Up Next
Get User Picture using Lync (Skye for Business) SDK