Skip to Content
author's profile photo Former Member
Former Member

Getting the user names - not working

Hi all,

I am using the following code to get all the users currently registred in the portal.

ISearchResult result =UMFactory.getUserFactory().getUniqueIDs();

while (result.hasNext()){

IUser tempUser = UMFactory.getUserFactory().getUser(result.next().toString());

}

Issues:-

1) It does not get the list of portal users.

2) how do I get the portal user's portal ID(what's the API for that)??

Please help me in this.

Regards,

Narahari

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Oct 02, 2005 at 12:32 PM

    Hi Narahari,

    What do you mean it doesn't work?

    I took your code as is and it worked perfectly. I justed put the code in a try/catch block, and added the needed imports and SharingReferences.

    Daniel

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 30, 2005 at 03:40 PM

    HI

    Try this code

    			IUserFactory userfactory = UMFactory.getUserFactory();
    
    			IUserSearchFilter userfltr = userfactory.getUserSearchFilter();
    			userfltr.setMaxSearchResultSize(2000);
    			ISearchResult result = userfactory.searchUsers(userfltr);
    			while (result.hasNext())
    			{
    				Vector inData = new Vector();
    				String uniqueid = (String) result.next();
    				IUser user = userfactory.getUser(uniqueid);
    				System.out.println("User Name " + user.getName());
    			}

    Rgds

    Raj

    <b>PS: Please Consider rewarding points.</b>

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      The code I have given you is working fine at my end.

      What exactly your error is? Have you seen your log??

      I suppose you are using Web Dynpro

      To check whether your are able to get the user’s email or not just write a sample web Dynpro application and inside wdDoInit()write this code and run your application your will be able to see all email on your screen:

      try

      {

      IUserFactory userfactory = UMFactory.getUserFactory();

      IUserSearchFilter userfltr = userfactory.getUserSearchFilter();

      userfltr.setMaxSearchResultSize(2000);

      ISearchResult result = userfactory.searchUsers(userfltr);

      while (result.hasNext())

      {

      Vector inData = new Vector();

      String uniqueid = (String) result.next();

      IUser user = userfactory.getUser(uniqueid);

      wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("User email:" + user.getEmail());

      }

      }

      catch (Exception e)

      {

      wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("USer :" + e.getMessage());

      e.printStackTrace();

      }

      Check where the problem is, it may be with the RFC call..

      Rgds,

      Raj

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.