0

Can anyone tell me how to get the chatter profile pic using connect api in visualforce page? I need a sample code for this...Because I am new to connect api.

Thanks in advance
Karthick

2 Answers 2

0

You dont need ConnectApi to get the photoURL

You can query User Object to get PhotoURL of any User ,The User object has SmallPhotoURL and LargePhotoURL as fields .This holds the profile photo of chatter

Edit

Blob image = attachment.body;//its the blob of your attachment body or blob data of your image
    //Call the Connect API to Change the Photo
     if(!Test.isRunningTest()){//Since for this we dont have any way of testing this we skip using isTesting Flag
                ConnectApi.BinaryInput b=new ConnectApi.BinaryInput(image,contenttype,'myimage');
                ConnectApi.ChatterUsers.setPhoto(null,userinfo.getUserId(),b);
     }

You will need first blob data of your image and then construct connectapi.binary Input from that and then use setphoto to change photo of user.Set photo pass userId and binary data

2
  • I know that but im my requirement I have to upload photo and display photo using connect api.. please give some idea Dec 15, 2014 at 5:00
  • 1
    Added the code so that it helps you .You will need first blob data of your image and then construct connectapi.binary Input from that and then use setphoto to change photo of user , Dec 15, 2014 at 5:06
0

Dont need the api u can do it in profiles only and every thing which u edit for home page go to setup customize their

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .