cancel
Showing results for 
Search instead for 
Did you mean: 

UniqueID -> UME

Former Member
0 Kudos

Iam struggling to get UniqueID or UID when i know Display Name of a user in Portal.

Is it through ISearchResult?

//dname is the string -> Display Name of User

try{
			
	IUserSearchFilter userFilt = userFact.getUserSearchFilter();
	userFilt.setDisplayName(dName,ISearchAttribute.EQUALS_OPERATOR, false);

	ISearchResult result = userFact.searchUsers(userFilt);
	
	if(result.getState()==ISearchResult.SEARCH_RESULT_OK){
	
		while(result.hasNext()){
			String uniqId= (String) result.next();
			IUser thisUser = userFact.getUser(uniqId);
			response.write(thisUser.getDisplayName().toString());
		}
	}
}catch...........

How wud i catch UniqueID of a user??

Somebody plz hint me ...

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Answers (3)

Answers (3)

Former Member
0 Kudos

I am Sending you a link.. which shuld solve your problem, It will give the user ids of users...

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/ep/code-samples/li... logged on users code sample download.abst

vinod.

Former Member
0 Kudos

Hi Peter,

Try this code:

String logonID = user.getUid();

IUserAccount accounts[] = null;

try {

accounts = user.getUserAccounts();

} catch (UMException e) {

response.write(("<br>Error getting accounts: " + e.getLocalizedMessage());

}

if (accounts != null) {

response.write("<br>Number of Login Accounts: " + accounts.length);

for (int i = 0; i < accounts.length; i++) {

response.write(

"<br>** Login ID #" + i

+ ": LogonUID=" + accounts<i>.getLogonUid()

+ ", AssignedUID=" + accounts<i>.getAssignedUserID());

response.write(

"<br>Last Login: "

+ accounts<i>.getLastSuccessfulLogonDate().toString());

response.write(

"<br># Logins: " + accounts<i>.getSuccessfulLogonCounts());

}

}

Regards,

Pooja.

Former Member
0 Kudos

Hi peter,

you may try this code..


try	{
 		IWDClientUser wdUser = WDClientUser.getCurrentUser();
		IUser user = wdUser.getSAPUser();
		if (user != null)
			{
				IUserAccount[] acct = user.getUserAccounts();
				if(acct[0] != null)
					{
						String strUserid = acct[0].getLogonUid();
wdContext.currentZtms_Fm_Regupdate_InputElement().setAssoid(new String(strUserid));
					}
			}
}

or try this PDF for more details regarding UME.

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/ep/d-f/Developer%2...

regards,

Vinod.

Former Member
0 Kudos

Thanx Vinod,

Could you tell me how to get UID of a different User (not currently logged on User) with Display name?Iam working with JSPDynpage solutions..not WebDynpro...U have any ideas???

Thanks vinod for ur time,

regards.