I have to access a chatter photo in Sites VF page using partner portal. I know that chatter photo cant be accessed by partner portal users. Is there any work around?
I saw this link which says that we can implement using oauth token. http://blogs.developerforce.com/developer-relations/2011/03/accessing-chatter-user-pics.html
Here is my photo url :- https://c.cs11.content.force.com/profilephoto/729G00000008q3L/F
How do I obtain the oauth token? I just created a remote access with call back url as :- https://app.example.com/oauth/callback and these two keys got generated automatically :-
Consumer Key :-
[deleted]
Consumer Secret :-
[deleted]
and here is my sites url (integrated with partner portal):- http://xy.xyz.cs11.force.com/MySite/
Can You please tell me what I need to append in my url and which url (c.cs11.content or my site url?) and what token should i append to see my photo in my site?
Attribution to: Priyanka
Possible Suggestion/Solution #1
Finally I found the solution. Instead of using Oauth, I did the same in a different way.
- Created one custom object with a lookup to user.
- Created a field to save the 'FullPhotoURL' of that user
- Got the image as blob and saved as an attachment to this custom object.
From my sites page, I queried this Custom object and showed the image from the attachment
Attribution to: Priyanka
Possible Suggestion/Solution #2
There is better solution using chatter connect API.
public String getUserPhotoURL(String UserId) {
ConnectApi.Photo ph = ConnectApi.ChatterUsers.getPhoto(null, UserId);
return ph.fullEmailPhotoUrl;
}
Read more in my blog: http://sforcenotes.blogspot.com/2015/10/solution-to-display-salesforce-user.html
Attribution to: nikitakarpenkov
Possible Suggestion/Solution #3
http://cloudyworlds.blogspot.in/2012/09/cloudy-using-poster-mozilla-tool-to-get.html
This will give you how to obtain access token or Oauth token from SFDC .Then you can proceed as sandeep pointed in previous blog.
Also since sandeep mentions even session id can do, you may use userinfo.getSessionId() method .Refer Userinfo class of apex.follow the below link http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_userinfo.htm
Adding further here is another post that may help you
http://salesforceapexcodecorner.blogspot.in/2012/05/user-photo-not-visible-on-forcecom-site.html
Attribution to: Mohith Shrivastava
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/1903