huangsike Absent Member.
Absent Member.
2448 views

Get User Email

Hi,

Is possible to get the user information, say email address, by sending a username to the POA?

Regards,
Sike
Labels (1)
0 Likes
7 Replies
Anonymous_User Absent Member.
Absent Member.

Re: Get User Email

I'm not sure what you are asking.
You can query the system address book to get
the users (and their email addresses).
If you are a trusted application,you can call
getUserListRequest to get the list of users
(and their email addresses) of the post office
you are connected to.

Preston

>>> On Tuesday, June 02, 2009 at 4:16 AM,

huangsike<huangsike@no-mx.forums.novell.com> wrote:

> Hi,
>
> Is possible to get the user information, say email address, by sending
> a username to the POA?
>
> Regards,
> Sike

0 Likes
huangsike Absent Member.
Absent Member.

Re: Get User Email

Let me clarify it,

Supposed I logged in as demo1


PlainText ptLogin = new PlainText();
ptLogin.setUsername("demo1");
ptLogin.setPassword("demo142");
LoginResponse loginResponse = gwService.loginRequest(ptLogin, "en", new BigDecimal(1.0), "Java Demo Application", true, false);


how do I get the email address (or other profile data) of a user, by knowing his username, say "demo2"?


Regards,
Sike
0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Get User Email

The easiest would be to get the
entries of the system address book
(preferably using cursor calls).

If you want just one user, you could
do a getItemsRequest on the system
address book and pass a filter of:
username eq demo2.

Preston

>>> On Tuesday, June 02, 2009 at 5:56 AM,

huangsike<huangsike@no-mx.forums.novell.com> wrote:

> Let me clarify it,
>
> Supposed I logged in as demo1
>
>
> Code:
> ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑
>
> PlainText ptLogin = new PlainText();
> ptLogin.setUsername("demo1");
> ptLogin.setPassword("demo142");
> LoginResponse loginResponse = gwService.loginRequest(ptLogin, "en", new


> BigDecimal(1.0), "Java Demo Application", true, false);
>
> ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑
>
>
> how do I get the email address (or other profile data) of a user, by
> knowing his username, say "demo2"?
>
>
> Regards,
> Sike

0 Likes
huangsike Absent Member.
Absent Member.

Re: Get User Email

Thanks for your hint, Preston.
Can you check if my following code snippet, it works, but I wanna know whether my way of getting the system address book is correct, especially.


GetAddressBookListResponse getAddressBookListResponse = gwService.getAddressBookListRequest(loginResponse.getSession(), false);
AddressBook gwSysAddrBook = null;
for (AddressBook addressBook : getAddressBookListResponse.getBooks().getBook()) {
if (addressBook.getName().equals("Novell GroupWise Address Book")) {
gwSysAddrBook = addressBook;
break;
}
}
Filter filter = new Filter();
FilterEntry filterEntry = new FilterEntry();
filterEntry.setOp(FilterOp.eq);
filterEntry.setField("username");
filterEntry.setValue("demo2");
filter.setElement(filterEntry);
GetItemsResponse getItemsResponse = gwService.getItemsRequest(gwSysAddrBook.getId(), null, filter, null, 500, loginResponse.getSession(), false);
Item[] items = getItemsResponse.getItems().getItem();
Contact contact = (Contact) items[0];
System.out.println(contact.getEmailList().getPrimary());
System.out.println(contact.getName());
0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Get User Email

It looks like it should work.

>>> On Tuesday, June 02, 2009 at 8:46 AM,

huangsike<huangsike@no-mx.forums.novell.com> wrote:

> Thanks for your hint, Preston.
> Can you check if my following code snippet, it works, but I wanna know
> whether my way of getting the system address book is correct,
> especially.
>
>
> Code:
> ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑
>
> GetAddressBookListResponse getAddressBookListResponse =
> gwService.getAddressBookListRequest(loginResponse.getSession(), false);


>
> AddressBook gwSysAddrBook = null;


>
> for (AddressBook addressBook :
> getAddressBookListResponse.getBooks().getBook()) {


>
> if (addressBook.getName().equals("Novell GroupWise Address Book")) {


>
> gwSysAddrBook = addressBook;


>
> break;


>
> }


>
> }


>
> Filter filter = new Filter();


>
> FilterEntry filterEntry = new FilterEntry();


>
> filterEntry.setOp(FilterOp.eq);


>
> filterEntry.setField("username");


>
> filterEntry.setValue("demo2");


>
> filter.setElement(filterEntry);


>
> GetItemsResponse getItemsResponse =
> gwService.getItemsRequest(gwSysAddrBook.getId(), null, filter, null, 500,


> loginResponse.getSession(), false);
> Item[] items = getItemsResponse.getItems().getItem();


>
> Contact contact = (Contact) items[0];


>
> System.out.println(contact.getEmailList().getPrimary());


>
> System.out.println(contact.getName());


>
>
> ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑

0 Likes
huangsike Absent Member.
Absent Member.

Re: Get User Email

In the Java demo shipped with "novell-gwsoap-devel-2008.12.23-1cross_platform:


resp = m_gwdemo.getGWService().getItemsRequest("GroupWiseSystemAddressBook@52", view, filt, null, 0, m_gwdemo.getSessionId(), false);


It uses a specific container key "GroupWiseSystemAddressBook@52" for the Novell GroupWise Address Book, is it only applicable in the test server 151.155.5.234, or is it the same for all GroupWise system?

Regards,
Sike
0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Get User Email

It applies to all system address books.

>>> On Friday, June 05, 2009 at 3:56 AM,

huangsike<huangsike@no-mx.forums.novell.com> wrote:

> In the Java demo shipped with
> "novell‑gwsoap‑devel‑2008.12.23‑1cross_platform:
>
>
> Code:
> ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑
>
> resp =
> m_gwdemo.getGWService().getItemsRequest("GroupWiseSystemAddressBook@52",
> view, filt, null, 0, m_gwdemo.getSessionId(), false);
>
> Code:
> ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑
>
>
> It uses a specific container key "GroupWiseSystemAddressBook@52" for

the
> Novell GroupWise Address Book, is it only applicable in the test server
> 151.155.5.234, or is it the same for all GroupWise system?
>
> Regards,
> Sike

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.