cancel
Showing results for 
Search instead for 
Did you mean: 

Getting picture of a user from java

Former Member
0 Kudos

hey everybody,

I would like to know how to access the picture of a portaluser from a PortalApplication written in java.

I already found out how to loop over the user accounts by doing:


UMFactory uf = UMFactory.getInstance();
IUserAccountFactory iuf = uf.getUserAccountFactory();
IUserAccount account = iuf.getUserAccountByLogonId(ids<i>.toString());
IUser user = account.getAssignedUser();

But I can't figure out how to get to the pictures.

Can anyone tell me how to do this?

Thanks

Greets

Wouter

Accepted Solutions (1)

Accepted Solutions (1)

former_member388485
Contributor
0 Kudos

Hi,

Take a look at this:

<a href="https://www.sdn.sap.com/irj/sdn/thread?messageID=1057723#1057723">https://www.sdn.sap.com/irj/sdn/thread?messageID=1057723#1057723</a>

Best Regards,

Avishai Zamir

Former Member
0 Kudos

okay,

I managed to create the url and thus see the picture of the user.

But now I want to display it in a image placeholder in htmlb.

So i creaty my url like this:


account = iuf.getUserAccountByLogonId("Student6");
IUser user = account.getAssignedUser();
uname = user.getUniqueID();
String url = http://cernum19.cernum.com:50000/irj/servlet/prt/portal/prtroot/com.sap.netweaver.kmc.people.UserPhotoRenderer?mode=normal&userid="+uname;
session.putValue("url",url);

Then I try to read it in my jsp like this:


<hbj:image
               id="Logo"
               tooltip="center of ebiz"
               width="70"
               height="35"
               src="<%=componentRequest.getComponentSession().getValue("url").toString()%>"
               alt="picture not found"

    />

But I get an error then...

Don't realy know what to do with this :s

Greets

Wouter

UPDATE:

It works now

Did it like this:

<% String url = componentRequest.getComponentSession().getValue("url").toString();%>

<hbj:image

id="Logo"

tooltip="center of ebiz"

width="100"

height="130"

src="<%=url%>"

alt="picture not found"

/>

Thanks

Message was edited by:

Wouter Delellio

Answers (0)