Skip to Content
author's profile photo
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 comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    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 comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Narahari,

      I seems that you're missing a statement that actually executes the RFC:

      wdContext
           .currentCmpCtx_Z_Sd_Broadcasting_Mail_InputElement()
           .modelObject()
           .execute();

      Hope that helps,

      Yoav.

  • author's profile photo
    Former Member
    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 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